home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / perl5000.zip / perl5000 / Configure < prev    next >
Text File  |  1994-10-12  |  164KB  |  7,736 lines

  1. #! /bin/sh
  2. #
  3. # If these # comments don't work, trim them. Don't worry about any other
  4. # shell scripts, Configure will trim # comments from them for you.
  5. #
  6. # (If you are trying to port this package to a machine without sh,
  7. # I would suggest you have a look at the prototypical config_h.SH file
  8. # and edit it to reflect your system. Some packages may include samples
  9. # of config.h for certain machines, so you might look for one of those.)
  10. #
  11. # Yes, you may rip this off to use in other distribution packages. This
  12. # script belongs to the public domain and cannot be copyrighted.
  13. #
  14. # (Note: this Configure script was generated automatically. Rather than
  15. # working with this copy of Configure, you may wish to get metaconfig.
  16. # The dist-3.0 package (which contains metaconfig) was posted in
  17. # comp.sources.misc so you may fetch it yourself from your nearest
  18. # archive site. Check with Archie if you don't know where that can be.)
  19. #
  20.  
  21. # $Id: Head.U,v 3.0.1.5 1994/08/29 16:03:44 ram Exp $
  22. #
  23. # Generated on Tue Oct 11 22:49:31 EDT 1994 [metaconfig 3.0 PL35]
  24.  
  25. cat >/tmp/c1$$ <<EOF
  26. ARGGGHHHH!!!!!
  27.  
  28. SCO csh still thinks true is false.  Write to SCO today and tell them that next
  29. year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
  30.  
  31. (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
  32. we'd have to do is go in and swap the && and || tokens, wherever they are.)
  33.  
  34. [End of diatribe. We now return you to your regularly scheduled programming...]
  35. EOF
  36. cat >/tmp/c2$$ <<EOF
  37.  
  38. OOPS!  You naughty creature!  You didn't run Configure with sh!
  39. I will attempt to remedy the situation by running sh for you...
  40. EOF
  41.  
  42. true || cat /tmp/c1$$ /tmp/c2$$
  43. true || exec sh $0 $argv:q
  44.  
  45. (exit $?0) || cat /tmp/c2$$
  46. (exit $?0) || exec sh $0 $argv:q
  47. rm -f /tmp/c1$$ /tmp/c2$$
  48.  
  49. : compute my invocation name
  50. me=$0
  51. case "$0" in
  52. */*)
  53.     me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
  54.     test "$me" || me=$0
  55.     ;;
  56. esac
  57.  
  58.  
  59. : Proper PATH setting
  60. paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
  61. paths=$paths:'/usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin'
  62. paths=$paths:'/sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb'
  63. paths=$paths:'/bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin'
  64. paths=$paths:'/etc /usr/lib /usr/ucblib /lib /usr/ccs/lib'
  65. paths=$paths:'/sbin /usr/sbin /usr/libexec'
  66.  
  67. for p in $paths
  68. do
  69.     case ":$PATH:" in
  70.     *:$p:*) ;;
  71.     *) test -d $p && PATH=$PATH:$p ;;
  72.     esac
  73. done
  74.  
  75. PATH=.:$PATH
  76. export PATH
  77.  
  78. : Sanity checks
  79. if test ! -t 0; then
  80.     echo "Say 'sh $me', not 'sh <$me'"
  81.     exit 1
  82. fi
  83.  
  84. : On HP-UX, large Configure scripts may exercise a bug in /bin/sh
  85. if test -f /hp-ux -a -f /bin/ksh; then
  86.     if (PATH=.; alias -x) >/dev/null 2>&1; then
  87.         : already under /bin/ksh
  88.     else
  89.         cat <<'EOM'
  90. (Feeding myself to ksh to avoid nasty sh bug in "here document" expansion.)
  91. EOM
  92.         exec /bin/ksh $0 "$@"
  93.     fi
  94. else
  95.     : Warn them if they use ksh on other systems
  96.     (PATH=.; alias -x) >/dev/null 2>&1 && \
  97.         cat <<EOM
  98. (I see you are using the Korn shell.  Some ksh's blow up on $me,
  99. especially on exotic machines.  If yours does, try the Bourne shell instead.)
  100. EOM
  101. fi
  102.  
  103. : Configure runs within the UU subdirectory
  104. test -d UU || mkdir UU
  105. cd UU && rm -f *
  106.  
  107. dynamic_ext=''
  108. extensions=''
  109. known_extensions=''
  110. static_ext=''
  111. useposix=''
  112. d_eunice=''
  113. d_xenix=''
  114. eunicefix=''
  115. Mcc=''
  116. awk=''
  117. bash=''
  118. bison=''
  119. byacc=''
  120. cat=''
  121. chgrp=''
  122. chmod=''
  123. chown=''
  124. compress=''
  125. cp=''
  126. cpio=''
  127. cpp=''
  128. csh=''
  129. date=''
  130. echo=''
  131. egrep=''
  132. emacs=''
  133. expr=''
  134. find=''
  135. flex=''
  136. gcc=''
  137. grep=''
  138. inews=''
  139. ksh=''
  140. less=''
  141. line=''
  142. lint=''
  143. ln=''
  144. lp=''
  145. lpr=''
  146. ls=''
  147. mail=''
  148. mailx=''
  149. make=''
  150. mkdir=''
  151. more=''
  152. mv=''
  153. nroff=''
  154. perl=''
  155. pg=''
  156. pmake=''
  157. pr=''
  158. rm=''
  159. rmail=''
  160. sed=''
  161. sendmail=''
  162. sh=''
  163. shar=''
  164. sleep=''
  165. smail=''
  166. sort=''
  167. submit=''
  168. tail=''
  169. tar=''
  170. tbl=''
  171. test=''
  172. touch=''
  173. tr=''
  174. troff=''
  175. uname=''
  176. uniq=''
  177. uuname=''
  178. vi=''
  179. zcat=''
  180. libswanted=''
  181. hint=''
  182. myuname=''
  183. osname=''
  184. osvers=''
  185. Author=''
  186. Date=''
  187. Header=''
  188. Id=''
  189. Locker=''
  190. Log=''
  191. RCSfile=''
  192. Revision=''
  193. Source=''
  194. State=''
  195. afs=''
  196. alignbytes=''
  197. archlib=''
  198. archlibexp=''
  199. archname=''
  200. d_archlib=''
  201. installarchlib=''
  202. bin=''
  203. binexp=''
  204. installbin=''
  205. byteorder=''
  206. cc=''
  207. gccversion=''
  208. ccflags=''
  209. cppflags=''
  210. ldflags=''
  211. lkflags=''
  212. optimize=''
  213. cf_by=''
  214. cf_time=''
  215. contains=''
  216. cpp_stuff=''
  217. cpplast=''
  218. cppminus=''
  219. cpprun=''
  220. cppstdin=''
  221. d_access=''
  222. d_alarm=''
  223. d_attrib=''
  224. d_bcmp=''
  225. d_bcopy=''
  226. d_bzero=''
  227. d_casti32=''
  228. castflags=''
  229. d_castneg=''
  230. d_charsprf=''
  231. d_chown=''
  232. d_chroot=''
  233. d_chsize=''
  234. d_closedir=''
  235. d_void_closedir=''
  236. d_const=''
  237. cryptlib=''
  238. d_crypt=''
  239. d_csh=''
  240. d_cuserid=''
  241. d_dbl_dig=''
  242. d_difftime=''
  243. d_dlerror=''
  244. d_dlopen=''
  245. d_dlsymun=''
  246. d_dosuid=''
  247. d_suidsafe=''
  248. d_drem=''
  249. d_dup2=''
  250. d_fchmod=''
  251. d_fchown=''
  252. d_fcntl=''
  253. d_fd_macros=''
  254. d_fd_set=''
  255. d_fds_bits=''
  256. d_fgetpos=''
  257. d_flexfnam=''
  258. d_flock=''
  259. d_fmod=''
  260. d_fork=''
  261. d_fsetpos=''
  262. d_Gconvert=''
  263. d_getgrps=''
  264. d_gethent=''
  265. aphostname=''
  266. d_gethname=''
  267. d_phostname=''
  268. d_uname=''
  269. d_getlogin=''
  270. d_getpgrp2=''
  271. d_getpgrp=''
  272. d_getppid=''
  273. d_getprior=''
  274. d_group=''
  275. d_htonl=''
  276. d_isascii=''
  277. d_killpg=''
  278. d_link=''
  279. d_linuxstd=''
  280. d_locconv=''
  281. d_lockf=''
  282. d_lstat=''
  283. d_mblen=''
  284. d_mbstowcs=''
  285. d_mbtowc=''
  286. d_memcmp=''
  287. d_memcpy=''
  288. d_memmove=''
  289. d_memset=''
  290. d_mkdir=''
  291. d_mkfifo=''
  292. d_mktime=''
  293. d_msg=''
  294. d_msgctl=''
  295. d_msgget=''
  296. d_msgrcv=''
  297. d_msgsnd=''
  298. d_nice=''
  299. d_open3=''
  300. d_passwd=''
  301. d_fpathconf=''
  302. d_pathconf=''
  303. d_pause=''
  304. d_pipe=''
  305. d_portable=''
  306. d_readdir=''
  307. d_rewinddir=''
  308. d_seekdir=''
  309. d_telldir=''
  310. d_readlink=''
  311. d_rename=''
  312. d_rmdir=''
  313. d_safebcpy=''
  314. d_safemcpy=''
  315. d_select=''
  316. d_sem=''
  317. d_semctl=''
  318. d_semget=''
  319. d_semop=''
  320. d_setegid=''
  321. d_seteuid=''
  322. d_setlinebuf=''
  323. d_setlocale=''
  324. d_setpgid=''
  325. d_setpgrp2=''
  326. d_bsdpgrp=''
  327. d_setpgrp=''
  328. d_setprior=''
  329. d_setregid=''
  330. d_setresgid=''
  331. d_setresuid=''
  332. d_setreuid=''
  333. d_setrgid=''
  334. d_setruid=''
  335. d_setsid=''
  336. d_shm=''
  337. d_shmat=''
  338. d_shmatprototype=''
  339. shmattype=''
  340. d_shmctl=''
  341. d_shmdt=''
  342. d_shmget=''
  343. d_oldsock=''
  344. d_socket=''
  345. d_sockpair=''
  346. sockethdr=''
  347. socketlib=''
  348. d_statblks=''
  349. d_stdstdio=''
  350. d_index=''
  351. d_strchr=''
  352. d_strcoll=''
  353. d_strctcpy=''
  354. d_strerrm=''
  355. d_strerror=''
  356. d_sysernlst=''
  357. d_syserrlst=''
  358. d_strxfrm=''
  359. d_symlink=''
  360. d_syscall=''
  361. d_sysconf=''
  362. d_system=''
  363. d_tcgetpgrp=''
  364. d_tcsetpgrp=''
  365. d_time=''
  366. timetype=''
  367. clocktype=''
  368. d_times=''
  369. d_truncate=''
  370. d_tzname=''
  371. d_umask=''
  372. d_vfork=''
  373. usevfork=''
  374. d_voidsig=''
  375. signal_t=''
  376. d_volatile=''
  377. d_charvspr=''
  378. d_vprintf=''
  379. d_wait4=''
  380. d_waitpid=''
  381. d_wcstombs=''
  382. d_wctomb=''
  383. dlext=''
  384. cccdlflags=''
  385. ccdlflags=''
  386. dlsrc=''
  387. lddlflags=''
  388. usedl=''
  389. fpostype=''
  390. gidtype=''
  391. groupstype=''
  392. h_fcntl=''
  393. h_sysfile=''
  394. i_db=''
  395. i_dbm=''
  396. d_dirnamlen=''
  397. direntrytype=''
  398. i_dirent=''
  399. i_dld=''
  400. i_dlfcn=''
  401. i_fcntl=''
  402. i_float=''
  403. i_gdbm=''
  404. i_grp=''
  405. i_limits=''
  406. i_malloc=''
  407. i_math=''
  408. i_memory=''
  409. i_ndbm=''
  410. i_neterrno=''
  411. i_niin=''
  412. i_sysin=''
  413. d_pwage=''
  414. d_pwchange=''
  415. d_pwclass=''
  416. d_pwcomment=''
  417. d_pwexpire=''
  418. d_pwquota=''
  419. i_pwd=''
  420. i_stddef=''
  421. i_stdlib=''
  422. i_string=''
  423. strings=''
  424. i_sysdir=''
  425. i_sysfile=''
  426. d_voidtty=''
  427. i_bsdioctl=''
  428. i_sysfilio=''
  429. i_sysioctl=''
  430. i_syssockio=''
  431. i_sysndir=''
  432. i_sysparam=''
  433. i_sysselct=''
  434. i_systimes=''
  435. i_sgtty=''
  436. i_termio=''
  437. i_termios=''
  438. i_systime=''
  439. i_systimek=''
  440. i_time=''
  441. timeincl=''
  442. i_unistd=''
  443. i_utime=''
  444. i_stdarg=''
  445. i_varargs=''
  446. i_varhdr=''
  447. i_vfork=''
  448. intsize=''
  449. libc=''
  450. glibpth=''
  451. libpth=''
  452. plibpth=''
  453. xlibpth=''
  454. libs=''
  455. lns=''
  456. lseektype=''
  457. d_mymalloc=''
  458. mallocobj=''
  459. mallocsrc=''
  460. malloctype=''
  461. usemymalloc=''
  462. installmansrc=''
  463. manext=''
  464. mansrc=''
  465. mansrcexp=''
  466. huge=''
  467. large=''
  468. medium=''
  469. models=''
  470. small=''
  471. split=''
  472. modetype=''
  473. mydomain=''
  474. myhostname=''
  475. phostname=''
  476. c=''
  477. n=''
  478. groupcat=''
  479. hostcat=''
  480. passcat=''
  481. orderlib=''
  482. ranlib=''
  483. package=''
  484. spackage=''
  485. prefix=''
  486. installprivlib=''
  487. privlib=''
  488. privlibexp=''
  489. prototype=''
  490. randbits=''
  491. installscript=''
  492. scriptdir=''
  493. scriptdirexp=''
  494. selecttype=''
  495. sig_name=''
  496. sizetype=''
  497. so=''
  498. sharpbang=''
  499. shsharp=''
  500. spitshell=''
  501. ssizetype=''
  502. startsh=''
  503. stdchar=''
  504. sysman=''
  505. uidtype=''
  506. nm_opt=''
  507. runnm=''
  508. usenm=''
  509. incpath=''
  510. mips=''
  511. mips_type=''
  512. usrinc=''
  513. defvoidused=''
  514. voidflags=''
  515. yacc=''
  516. yaccflags=''
  517. CONFIG=''
  518.  
  519. : script used to extract .SH files with variable substitutions
  520. cat >extract <<'EOS'
  521. CONFIG=true
  522. echo "Doing variable substitutions on .SH files..."
  523. if test -f MANIFEST; then
  524.     shlist=`awk '{print $1}' <MANIFEST | grep '\.SH'`
  525.     : Pick up possible extension manifests.
  526.     for dir in ext/* ; do
  527.         if test -f $dir/MANIFEST; then
  528.             xxx=`awk '{print $1}' < $dir/MANIFEST | 
  529.                 sed -n "/\.SH$/ s@^@$dir/@p"`
  530.             shlist="$shlist $xxx"
  531.         fi
  532.     done
  533.     set x $shlist
  534. else
  535.     echo "(Looking for .SH files under the current directory.)"
  536.     set x `find . -name "*.SH" -print`
  537. fi
  538. shift
  539. case $# in
  540. 0) set x *.SH; shift;;
  541. esac
  542. if test ! -f $1; then
  543.     shift
  544. fi
  545. for file in $*; do
  546.     case "$file" in
  547.     */*)
  548.         dir=`expr X$file : 'X\(.*\)/'`
  549.         file=`expr X$file : 'X.*/\(.*\)'`
  550.         (cd $dir && . ./$file)
  551.         ;;
  552.     *)
  553.         . ./$file
  554.         ;;
  555.     esac
  556. done
  557. if test -f config_h.SH; then
  558.     if test ! -f config.h; then
  559.     : oops, they left it out of MANIFEST, probably, so do it anyway.
  560.     . ./config_h.SH
  561.     fi
  562. fi
  563. EOS
  564.  
  565. : produce awk script to parse command line options
  566. cat >options.awk <<'EOF'
  567. BEGIN {
  568.     optstr = "deEf:hrsSD:U:V";    # getopt-style specification
  569.  
  570.     len = length(optstr);
  571.     for (i = 1; i <= len; i++) {
  572.         c = substr(optstr, i, 1);
  573.         if (i < len) a = substr(optstr, i + 1, 1); else a = "";
  574.         if (a == ":") {
  575.             arg[c] = 1;
  576.             i++;
  577.         }
  578.         opt[c] = 1;
  579.     }
  580. }
  581. {
  582.     expect = 0;
  583.     str = $0;
  584.     if (substr(str, 1, 1) != "-") {
  585.         printf("'%s'\n", str);
  586.         next;
  587.     }
  588.     len = length($0);
  589.     for (i = 2; i <= len; i++) {
  590.         c = substr(str, i, 1);
  591.         if (!opt[c]) {
  592.             printf("-%s\n", substr(str, i));
  593.             next;
  594.         }
  595.         printf("-%s\n", c);
  596.         if (arg[c]) {
  597.             if (i < len)
  598.                 printf("'%s'\n", substr(str, i + 1));
  599.             else
  600.                 expect = 1;
  601.             next;
  602.         }
  603.     }
  604. }
  605. END {
  606.     if (expect)
  607.         print "?";
  608. }
  609. EOF
  610.  
  611. : process the command line options
  612. set X `for arg in "$@"; do echo $arg; done | awk -f options.awk`
  613. eval "set $*"
  614. shift
  615. rm -f options.awk
  616.  
  617. : set up default values
  618. fastread=''
  619. reuseval=false
  620. config_sh=''
  621. alldone=''
  622. error=''
  623. silent=''
  624. extractsh=''
  625. optdef='optdef.sh'
  626.  
  627. : option parsing
  628. while test $# -gt 0; do
  629.     case "$1" in
  630.     -d) shift; fastread=yes;;
  631.     -e) shift; alldone=cont;;
  632.     -f)
  633.         shift
  634.         cd ..
  635.         if test -r "$1"; then
  636.             config_sh="$1"
  637.         else
  638.             echo "$me: cannot read config file $1." >&2
  639.             error=true
  640.         fi
  641.         cd UU
  642.         shift;;
  643.     -h) shift; error=true;;
  644.     -r) shift; reuseval=true;;
  645.     -s) shift; silent=true;;
  646.     -E) shift; alldone=exit;;
  647.     -S) shift; extractsh=true;;
  648.     -D)
  649.         shift
  650.         case "$1" in
  651.         *=)
  652.             echo "$me: use '-U symbol=', not '-D symbol='." >&2
  653.             echo "$me: ignoring -D $1" >&2
  654.             ;;
  655.         *=*) echo "$1" >> $optdef;;
  656.         *) echo "$1='define'" >> $optdef;;
  657.         esac
  658.         shift
  659.         ;;
  660.     -U)
  661.         shift
  662.         case "$1" in
  663.         *=) echo "$1" >> $optdef;;
  664.         *=*)
  665.             echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
  666.             echo "$me: ignoring -U $1" >&2
  667.             ;;
  668.         *) echo "$1='undef'" >> $optdef;;
  669.         esac
  670.         shift
  671.         ;;
  672.     -V) echo "$me generated by metaconfig 3.0 PL35." >&2
  673.         exit 0;;
  674.     --) break;;
  675.     -*) echo "$me: unknown option $1" >&2; shift; error=true;;
  676.     *) break;;
  677.     esac
  678. done
  679.  
  680. case "$error" in
  681. true)
  682.     cat >&2 <<EOM
  683. Usage: $me [-dehrESV] [-f config.sh] [-D symbol] [-D symbol=value]
  684.                  [-U symbol] [-U symbol=]
  685.   -d : use defaults for all answers.
  686.   -e : go on without questioning past the production of config.sh.
  687.   -f : specify an alternate default configuration file.
  688.   -h : print this help message and exit (with an error status).
  689.   -r : reuse C symbols value if possible (skips costly nm extraction).
  690.   -s : silent mode, only echoes questions and essential information.
  691.   -D : define symbol to have some value:
  692.          -D symbol         symbol gets the value 'define'
  693.          -D symbol=value   symbol gets the value 'value'
  694.   -E : stop at the end of questions, after having produced config.sh.
  695.   -S : perform variable substitutions on all .SH files (can mix with -f)
  696.   -U : undefine symbol:
  697.          -U symbol    symbol gets the value 'undef'
  698.          -U symbol=   symbol gets completely empty
  699.   -V : print version number and exit (with a zero status).
  700. EOM
  701.     exit 1
  702.     ;;
  703. esac
  704.  
  705. exec 4>&1
  706. case "$silent" in
  707. true) exec 1>/dev/null;;
  708. esac
  709.  
  710. : run the defines and the undefines, if any
  711. touch $optdef
  712. . ./$optdef
  713. rm -f $optdef
  714.  
  715. case "$extractsh" in
  716. true)
  717.     case "$config_sh" in
  718.     '') config_sh='config.sh'; config='./config.sh';;
  719.     /*) config="$config_sh";;
  720.     *) config="./$config_sh";;
  721.     esac
  722.     echo " "
  723.     echo "Fetching answers from $config_sh..."
  724.     cd ..
  725.     . $config
  726.     echo " "
  727.     . ./UU/extract
  728.     rm -rf UU
  729.     echo "Done."
  730.     exit 0
  731.     ;;
  732. esac
  733.  
  734. : set package name
  735. package=perl5
  736.  
  737. : Eunice requires " " instead of "", can you believe it
  738. echo " "
  739. : Here we go...
  740. echo "Beginning of configuration questions for $package."
  741.  
  742. define='define'
  743. undef='undef'
  744. smallmach='pdp11 i8086 z8000 i80286 iAPX286'
  745. rmlist=''
  746.  
  747. trap 'echo " "; rm -rf $rmlist; exit 1' 1 2 3 15
  748.  
  749. : We must find out about Eunice early
  750. eunicefix=':'
  751. if test -f /etc/unixtovms; then
  752.     eunicefix=/etc/unixtovms
  753. fi
  754. if test -f /etc/unixtovms.exe; then
  755.     eunicefix=/etc/unixtovms.exe
  756. fi
  757.  
  758. : list of known cpp symbols
  759. al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CRAY DGUX DOLPHIN DPX2"
  760. al="$al GO32 HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
  761. al="$al MIPSEB MIPSEL MSDOS MTXINU MVS"
  762. al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
  763. al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
  764. al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
  765. al="$al PWB R3000 SVR3 SVR4"
  766. al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV"
  767. al="$al UTEK UTS UTek UnicomPBB UnicomPBD Utek VMS"
  768. al="$al _AIX _AIX32 _AM29000 _COFF _CRAY _EPI _IBMR2"
  769. al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
  770. al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _R3000"
  771. al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
  772. al="$al _SYSTYPE_SYSV _SYSV3 _UNICOS"
  773. al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
  774. al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
  775. al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
  776. al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
  777. al="$al __Next__ __OSF1__ __PARAGON__ __PWB __STDC__"
  778. al="$al ____386BSD____ __alpha __alpha__ __amiga"
  779. al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
  780. al="$al __host_mips__"
  781. al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
  782. al="$al __hp9000s500 __hp9000s700 __hp9000s800"
  783. al="$al __hppa __hpux __i286 __i286__ __i386 __i386__"
  784. al="$al __i486 __i486__ __i860 __i860__"
  785. al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
  786. al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
  787. al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
  788. al="$al __mc88100 __mc88100__ __mips __mips__"
  789. al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
  790. al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
  791. al="$al __unix __unix__ __vax __vax__"
  792. al="$al _host_mips _mips _unix"
  793. al="$al a29k aegis alliant am29000 amiga ansi"
  794. al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bull"
  795. al="$al convex cray ctix encore gcos gimpel"
  796. al="$al hcx host_mips hp200 hp300 hp700 hp800"
  797. al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
  798. al="$al hp9000s700 hp9000s800 hp9k8 hpux"
  799. al="$al i186 i286 i386 i486 i8086"
  800. al="$al i80960 i860 iAPX286 ibm interdata is68k"
  801. al="$al linux luna luna88k m68k m88100 m88k"
  802. al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
  803. al="$al mc68040 mc68060 mc68k mc68k32 mc700"
  804. al="$al mc88000 mc88100 merlin mert mips mvs n16"
  805. al="$al ncl_el ncl_mr"
  806. al="$al news1500 news1700 news1800 news1900 news3700"
  807. al="$al news700 news800 news900 ns16000 ns32000"
  808. al="$al ns32016 ns32332 ns32k nsc32000 os osf"
  809. al="$al parisc pc532 pdp11 plexus posix pyr"
  810. al="$al riscix riscos sequent sgi sinix sony sony_news"
  811. al="$al sonyrisc sparc sparclite spectrum stratos"
  812. al="$al sun sun3 sun386 svr4 sysV68 sysV88"
  813. al="$al tower tower32 tower32_200 tower32_600 tower32_700"
  814. al="$al tower32_800 tower32_850 tss u3b u3b2 u3b20 u3b200"
  815. al="$al u3b5 ultrix unix unixpc unos vax venix vms"
  816. al="$al xenix z8000"
  817.  
  818. i_whoami=''
  819. : change the next line if compiling for Xenix/286 on Xenix/386
  820. xlibpth='/usr/lib/386 /lib/386'
  821.  
  822. : general looking path for locating libraries
  823. glibpth="/lib/pa1.1 /usr/lib/large /lib /usr/lib $xlibpth"
  824. glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
  825. glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib /usr/shlib"
  826.  
  827. : Private path used by Configure to find libraries.  Its value
  828. : is prepended to libpth. This variable takes care of special
  829. : machines, like the mips.  Usually, it should be empty.
  830. plibpth=''
  831.  
  832. : full support for void wanted by default
  833. defvoidused=15
  834.  
  835. : set useposix=false in your hint file to disable the POSIX extension.
  836. useposix=true
  837. gccversion=''
  838. : no include file wanted by default
  839. inclwanted=''
  840.  
  841. groupstype=''
  842. : default library list
  843. libswanted=''
  844. : List of libraries we want.
  845. libswanted='net socket inet nsl nm ndbm gdbm dbm db malloc dl'
  846. libswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt"
  847. libswanted="$libswanted ucb bsd BSD PW x"
  848. : We want to search /usr/shlib before most other libraries.
  849. : This is only used by ext/util/extliblist
  850. glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
  851. glibpth="/usr/shlib $glibpth"
  852. : Do not use vfork unless overridden by a hint file.
  853. usevfork=false
  854. : We can look for titanos too.
  855. al="$al ardent titan"
  856.  
  857. : Some greps do not return status, grrr.
  858. echo "grimblepritz" >grimble
  859. if grep blurfldyick grimble >/dev/null 2>&1 ; then
  860.     contains=contains
  861. elif grep grimblepritz grimble >/dev/null 2>&1 ; then
  862.     contains=grep
  863. else
  864.     contains=contains
  865. fi
  866. rm -f grimble
  867. : the following should work in any shell
  868. case "$contains" in
  869. contains*)
  870.     echo " "
  871.     echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
  872.     cat >contains <<'EOSS'
  873. grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
  874. EOSS
  875. chmod +x contains
  876. esac
  877.  
  878. : first determine how to suppress newline on echo command
  879. echo " "
  880. echo "Checking echo to see how to suppress newlines..."
  881. (echo "hi there\c" ; echo " ") >.echotmp
  882. if $contains c .echotmp >/dev/null 2>&1 ; then
  883.     echo "...using -n."
  884.     n='-n'
  885.     c=''
  886. else
  887.     cat <<'EOM'
  888. ...using \c
  889. EOM
  890.     n=''
  891.     c='\c'
  892. fi
  893. echo $n "The star should be here-->$c"
  894. echo '*'
  895. rm -f .echotmp
  896.  
  897. : Now test for existence of everything in MANIFEST
  898. echo " "
  899. if test -f ../MANIFEST; then
  900.     echo "First let's make sure your kit is complete.  Checking..." >&4
  901.     awk '$1 !~ /PACK[A-Z]+/ {print $1}' ../MANIFEST | split -50
  902.     rm -f missing
  903.     for filelist in x??; do
  904.         (cd ..; ls `cat UU/$filelist` >/dev/null 2>>UU/missing)
  905.     done
  906.     if test -s missing; then
  907.         cat missing >&4
  908.         cat >&4 <<'EOM'
  909.  
  910. THIS PACKAGE SEEMS TO BE INCOMPLETE.
  911.  
  912. You have the option of continuing the configuration process, despite the
  913. distinct possibility that your kit is damaged, by typing 'y'es.  If you
  914. do, don't blame me if something goes wrong.  I advise you to type 'n'o
  915. and contact the author (lwall@netlabs.com).
  916.  
  917. EOM
  918.         echo $n "Continue? [n] $c" >&4
  919.         read ans
  920.         case "$ans" in
  921.         y*)
  922.             echo "Continuing..." >&4
  923.             rm -f missing
  924.             ;;
  925.         *)
  926.             echo "ABORTING..." >&4
  927.             kill $$
  928.             ;;
  929.         esac
  930.     else
  931.         echo "Looks good..." >&4
  932.     fi
  933. else
  934.     echo "There is no MANIFEST file.  I hope your kit is complete !"
  935. fi
  936. rm -f missing x??
  937.  
  938. : compute the number of columns on the terminal for proper question formatting
  939. case "$COLUMNS" in
  940. '') COLUMNS='80';;
  941. esac
  942.  
  943. : set up the echo used in my read
  944. myecho="case \"\$xxxm\" in
  945. '') echo $n \"\$rp $c\" >&4;;
  946. *) case \"\$rp\" in
  947.     '') echo $n \"[\$xxxm] $c\";;
  948.     *)
  949.         if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
  950.             echo \"\$rp\" >&4
  951.             echo $n \"[\$xxxm] $c\" >&4
  952.         else
  953.             echo $n \"\$rp [\$xxxm] $c\" >&4
  954.         fi
  955.         ;;
  956.     esac;;
  957. esac"
  958.  
  959. : now set up to do reads with possible shell escape and default assignment
  960. cat <<EOSC >myread
  961. xxxm=\$dflt
  962. $myecho
  963. ans='!'
  964. case "\$fastread" in
  965. yes) case "\$dflt" in
  966.     '') ;;
  967.     *) ans='';
  968.         case "\$silent-\$rp" in
  969.         true-) ;;
  970.         *) echo " " >&4;;
  971.         esac;;
  972.     esac;;
  973. *) case "\$silent" in
  974.     true) case "\$rp" in
  975.         '') ans='';;
  976.         esac;;
  977.     esac;;
  978. esac
  979. while expr "X\$ans" : "X!" >/dev/null; do
  980.     read answ
  981.     set x \$xxxm
  982.     shift
  983.     aok=''; eval "ans=\"\$answ\"" && aok=y
  984.     case  "\$answ" in
  985.     "\$ans")
  986.         case "\$ans" in
  987.         "!")
  988.             sh 1>&4
  989.             echo " "
  990.             $myecho
  991.             ;;
  992.         !*)
  993.             set x \`expr "X\$ans" : "X!\(.*\)\$"\`
  994.             shift
  995.             sh 1>&4 -c "\$*"
  996.             echo " "
  997.             $myecho
  998.             ;;
  999.         esac;;
  1000.     *)
  1001.         case "\$aok" in
  1002.         y)
  1003.             echo "*** Substitution done -- please confirm."
  1004.             xxxm="\$ans"
  1005.             ans=\`echo $n "\$ans$c" | tr '\012' ' '\`
  1006.             xxxm="\$ans"
  1007.             ans=!
  1008.             ;;
  1009.         *)
  1010.             echo "*** Error -- try again."
  1011.             ans=!
  1012.             ;;
  1013.         esac
  1014.         $myecho
  1015.         ;;
  1016.     esac
  1017.     case "\$ans\$xxxm\$nostick" in
  1018.     '')
  1019.         ans=!
  1020.         $myecho
  1021.         ;;
  1022.     esac
  1023. done
  1024. case "\$ans" in
  1025. '') ans="\$xxxm";;
  1026. esac
  1027. EOSC
  1028.  
  1029. : create .config dir to save info across Configure sessions
  1030. test -d ../.config || mkdir ../.config
  1031. cat >../.config/README <<EOF
  1032. This directory created by Configure to save information that should
  1033. persist across sessions.
  1034.  
  1035. You may safely delete it if you wish.
  1036. EOF
  1037.  
  1038. : general instructions
  1039. needman=true
  1040. firsttime=true
  1041. user=`( (logname) 2>/dev/null || whoami) 2>&1`
  1042. if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
  1043.     firsttime=false
  1044.     echo " "
  1045.     rp='Would you like to see the instructions?'
  1046.     dflt=n
  1047.     . ./myread
  1048.     case "$ans" in
  1049.     [yY]*) ;;
  1050.     *) needman=false;;
  1051.     esac
  1052. fi
  1053. if $needman; then
  1054.     cat <<EOH
  1055.  
  1056. This installation shell script will examine your system and ask you questions
  1057. to determine how the perl5 package should be installed. If you get
  1058. stuck on a question, you may use a ! shell escape to start a subshell or
  1059. execute a command.  Many of the questions will have default answers in square
  1060. brackets; typing carriage return will give you the default.
  1061.  
  1062. On some of the questions which ask for file or directory names you are allowed
  1063. to use the ~name construct to specify the login directory belonging to "name",
  1064. even if you don't have a shell which knows about that.  Questions where this is
  1065. allowed will be marked "(~name ok)".
  1066.  
  1067. EOH
  1068.     rp=''
  1069.     dflt='Type carriage return to continue'
  1070.     . ./myread
  1071.     cat <<'EOH'
  1072.  
  1073. The prompter used in this script allows you to use shell variables and
  1074. backticks in your answers.  You may use $1, $2, etc...  to refer to the words
  1075. in the default answer, as if the default line was a set of arguments given to a
  1076. script shell.  This means you may also use $* to repeat the whole default line,
  1077. so you do not have to re-type everything to add something to the default.
  1078.  
  1079. Everytime there is a substitution, you will have to confirm.  If there is an
  1080. error (e.g. an unmatched backtick), the default answer will remain unchanged
  1081. and you will be prompted again.
  1082.  
  1083. If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
  1084. the questions and use the computed defaults (or the previous answers if there
  1085. was already a config.sh file). Type 'Configure -h' for a list of options.
  1086.  
  1087. EOH
  1088.     . ./myread
  1089.     cat <<EOH
  1090.  
  1091. Much effort has been expended to ensure that this shell script will run on any
  1092. Unix system.  If despite that it blows up on yours, your best bet is to edit
  1093. Configure and run it again.  Also, let me (lwall@netlabs.com)
  1094. know how I blew it.  If you can't run Configure for some reason, you'll have to
  1095. generate a config.sh file by hand.
  1096.  
  1097. This installation script affects things in two ways:
  1098.  
  1099. 1) it may do direct variable substitutions on some of the files included
  1100.    in this kit.
  1101. 2) it builds a config.h file for inclusion in C programs.  You may edit
  1102.    any of these files as the need arises after running this script.
  1103.  
  1104. If you make a mistake on a question, there is no easy way to back up to it
  1105. currently.  The easiest thing to do is to edit config.sh and rerun all the SH
  1106. files.  Configure will offer to let you do this before it runs the SH files.
  1107.  
  1108. EOH
  1109.     dflt='Type carriage return to continue'
  1110.     . ./myread
  1111.     case "$firsttime" in
  1112.     true) echo $user >>../.config/instruct;;
  1113.     esac
  1114. fi
  1115.  
  1116. : see if sh knows # comments
  1117. echo " "
  1118. echo "Checking your sh to see if it knows about # comments..." >&4
  1119. if sh -c '#' >/dev/null 2>&1 ; then
  1120.     echo "Your sh handles # comments correctly."
  1121.     shsharp=true
  1122.     spitshell=cat
  1123.     echo " "
  1124.     echo "Okay, let's see if #! works on this system..."
  1125.     xcat=/bin/cat
  1126.     test -r $xcat || xcat=/usr/bin/cat
  1127.     echo "#!$xcat" >try
  1128.     $eunicefix try
  1129.     chmod +x try
  1130.     ./try > today
  1131.     if test -s today; then
  1132.         echo "It does."
  1133.         sharpbang='#!'
  1134.     else
  1135.         echo "#! $xcat" > try
  1136.         $eunicefix try
  1137.         chmod +x try
  1138.         ./try > today
  1139.         if test -s today; then
  1140.             echo "It does."
  1141.             sharpbang='#! '
  1142.         else
  1143.             echo "It's just a comment."
  1144.             sharpbang=': use '
  1145.         fi
  1146.     fi
  1147. else
  1148.     echo "Your sh doesn't grok # comments--I will strip them later on."
  1149.     shsharp=false
  1150.     cd ..
  1151.     echo "exec grep -v '^[     ]*#'" >spitshell
  1152.     chmod +x spitshell
  1153.     $eunicefix spitshell
  1154.     spitshell=`pwd`/spitshell
  1155.     cd UU
  1156.     echo "I presume that if # doesn't work, #! won't work either!"
  1157.     sharpbang=': use '
  1158. fi
  1159. rm -f try today
  1160.  
  1161. : figure out how to guarantee sh startup
  1162. echo " "
  1163. echo "Checking out how to guarantee sh startup..." >&4
  1164. case "$SYSTYPE" in
  1165. *bsd*|sys5*) startsh=$sharpbang"/$SYSTYPE/bin/sh";;
  1166. *) startsh=$sharpbang'/bin/sh';;
  1167. esac
  1168. echo "Let's see if '$startsh' works..."
  1169. cat >try <<EOSS
  1170. $startsh
  1171. set abc
  1172. test "$?abc" != 1
  1173. EOSS
  1174.  
  1175. chmod +x try
  1176. $eunicefix try
  1177. if ./try; then
  1178.     echo "Yup, it does."
  1179. else
  1180. echo "Nope.  You may have to fix up the shell scripts to make sure sh runs them."
  1181. fi
  1182. rm -f try
  1183.  
  1184. : find out where common programs are
  1185. echo " "
  1186. echo "Locating common programs..." >&4
  1187. cat <<EOSC >loc
  1188. $startsh
  1189. case \$# in
  1190. 0) exit 1;;
  1191. esac
  1192. thing=\$1
  1193. shift
  1194. dflt=\$1
  1195. shift
  1196. for dir in \$*; do
  1197.     case "\$thing" in
  1198.     .)
  1199.     if test -d \$dir/\$thing; then
  1200.         echo \$dir
  1201.         exit 0
  1202.     fi
  1203.     ;;
  1204.     *)
  1205.     for thisthing in \$dir/\$thing; do
  1206.         : Just loop through to pick last element
  1207.     done
  1208.     if test -f \$thisthing; then
  1209.         echo \$thisthing
  1210.         exit 0
  1211.     elif test -f \$dir/\$thing.exe; then
  1212.         : on Eunice apparently
  1213.         echo \$dir/\$thing
  1214.         exit 0
  1215.     fi
  1216.     ;;
  1217.     esac
  1218. done
  1219. echo \$dflt
  1220. exit 1
  1221. EOSC
  1222. chmod +x loc
  1223. $eunicefix loc
  1224. loclist="
  1225. awk
  1226. cat
  1227. cp
  1228. echo
  1229. expr
  1230. find
  1231. grep
  1232. ln
  1233. ls
  1234. mkdir
  1235. rm
  1236. sed
  1237. sort
  1238. touch
  1239. tr
  1240. uniq
  1241. "
  1242. trylist="
  1243. Mcc
  1244. bison
  1245. byacc
  1246. cpp
  1247. csh
  1248. date
  1249. egrep
  1250. line
  1251. nroff
  1252. perl
  1253. test
  1254. uname
  1255. "
  1256. pth=`echo $PATH | sed -e 's/:/ /g'`
  1257. pth="$pth /lib /usr/lib"
  1258. for file in $loclist; do
  1259.     xxx=`./loc $file $file $pth`
  1260.     eval $file=$xxx
  1261.     eval _$file=$xxx
  1262.     case "$xxx" in
  1263.     /*)
  1264.         echo $file is in $xxx.
  1265.         ;;
  1266.     *)
  1267.         echo "I don't know where $file is.  I hope it's in everyone's PATH."
  1268.         ;;
  1269.     esac
  1270. done
  1271. echo " "
  1272. echo "Don't worry if any of the following aren't found..."
  1273. say=offhand
  1274. for file in $trylist; do
  1275.     xxx=`./loc $file $file $pth`
  1276.     eval $file=$xxx
  1277.     eval _$file=$xxx
  1278.     case "$xxx" in
  1279.     /*)
  1280.         echo $file is in $xxx.
  1281.         ;;
  1282.     *)
  1283.         echo "I don't see $file out there, $say."
  1284.         say=either
  1285.         ;;
  1286.     esac
  1287. done
  1288. case "$egrep" in
  1289. egrep)
  1290.     echo "Substituting grep for egrep."
  1291.     egrep=$grep
  1292.     ;;
  1293. esac
  1294. case "$test" in
  1295. test)
  1296.     echo "Hopefully test is built into your sh."
  1297.     ;;
  1298. *)
  1299.     if sh -c "PATH= test true" >/dev/null 2>&1; then
  1300.         echo "Using the test built into your sh."
  1301.         test=test
  1302.         _test=test
  1303.     fi
  1304.     ;;
  1305. esac
  1306. case "$echo" in
  1307. echo)
  1308.     echo "Hopefully echo is built into your sh."
  1309.     ;;
  1310. '') ;;
  1311. *)
  1312.     echo " "
  1313. echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
  1314.     $echo $n "hi there$c" >foo1
  1315.     echo $n "hi there$c" >foo2
  1316.     if cmp foo1 foo2 >/dev/null 2>&1; then
  1317.         echo "They are compatible.  In fact, they may be identical."
  1318.     else
  1319.         case "$n" in
  1320.         '-n') n='' c='\c';;
  1321.         *) n='-n' c='';;
  1322.         esac
  1323.         cat <<FOO
  1324. They are not compatible!  You are probably running ksh on a non-USG system.
  1325. I'll have to use $echo instead of the builtin, since Bourne shell doesn't
  1326. have echo built in and we may have to run some Bourne shell scripts.  That
  1327. means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
  1328.  
  1329. FOO
  1330.         $echo $n "The star should be here-->$c"
  1331.         $echo "*"
  1332.     fi
  1333.     $rm -f foo1 foo2
  1334.     ;;
  1335. esac
  1336.  
  1337. : determine whether symbolic links are supported
  1338. echo " "
  1339. $touch blurfl
  1340. if $ln -s blurfl sym > /dev/null 2>&1 ; then
  1341.     echo "Symbolic links are supported." >&4
  1342.     lns="$ln -s"
  1343. else
  1344.     echo "Symbolic links are NOT supported." >&4
  1345.     lns="$ln"
  1346. fi
  1347. $rm -f blurfl sym
  1348.  
  1349. : Try to determine whether config.sh was made on this system
  1350. case "$config_sh" in
  1351. '')
  1352. myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
  1353. myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
  1354.     tr '[A-Z]' '[a-z]' | tr '\012' ' '`
  1355. dflt=n
  1356. if test -f ../config.sh; then
  1357.     oldmyuname=''
  1358.     if $contains myuname= ../config.sh >/dev/null 2>&1; then
  1359.         eval "old`grep myuname= ../config.sh`"
  1360.     fi
  1361.     if test "X$myuname" = "X$oldmyuname"; then
  1362.         dflt=y
  1363.     fi
  1364. fi
  1365.  
  1366. : Get old answers from old config file if Configure was run on the
  1367. : same system, otherwise use the hints.
  1368. hint=default
  1369. cd ..
  1370. if test -f config.sh; then
  1371.     echo " "
  1372.     rp="I see a config.sh file.  Shall I use it to set the defaults?"
  1373.     . UU/myread
  1374.     case "$ans" in
  1375.     n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
  1376.     *)  echo "Fetching default answers from your old config.sh file..." >&4
  1377.         tmp="$n"
  1378.         tans="$c"
  1379.         . ./config.sh
  1380.         cp config.sh UU
  1381.         n="$tmp"
  1382.         c="$tans"
  1383.         hint=previous
  1384.         ;;
  1385.     esac
  1386. fi
  1387. if test ! -f config.sh; then
  1388.     $cat <<EOM
  1389.  
  1390. First time through, eh?  I have some defaults handy for the following systems:
  1391.  
  1392. EOM
  1393.     cd hints; ls -C *.sh | $sed 's/\.sh/   /g' >&4
  1394.     dflt=''
  1395.     : Half the following guesses are probably wrong... If you have better
  1396.     : tests or hints, please send them to lwall@netlabs.com
  1397.     : The metaconfig authors would also appreciate a copy...
  1398.     $test -f /irix && osname=irix
  1399.     $test -f /xenix && osname=sco_xenix
  1400.     $test -f /dynix && osname=dynix
  1401.     $test -f /dnix && osname=dnix
  1402.      $test -f /unicos && osname=unicos && osvers=`$uname -r`
  1403.     $test -f /bin/mips && /bin/mips && osname=mips
  1404.     $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
  1405.     $test -d /usr/apollo/bin && osname=apollo
  1406.     $test -f /etc/saf/_sactab && osname=svr4
  1407.     $test -d /usr/include/minix && osname=minix
  1408.     if $test -f $uname; then
  1409.         set X $myuname
  1410.         shift
  1411.  
  1412.         case "$5" in
  1413.         fps*) osname=fps ;;
  1414.         mips*)
  1415.             case "$4" in
  1416.             umips) osname=umips ;;
  1417.             *) osname=mips ;;
  1418.             esac;;
  1419.         [23]100) osname=mips ;;
  1420.         next*) osname=next ;;
  1421.         news*) osname=news ;;
  1422.         i386*) if $test -f /etc/kconfig; then
  1423.                 osname=isc
  1424.                 if test "$lns" = "ln -s"; then
  1425.                     osvers=4
  1426.                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
  1427.                     osvers=3
  1428.                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
  1429.                     osvers=2
  1430.                 fi
  1431.                fi
  1432.                ;;
  1433.         esac
  1434.  
  1435.         case "$1" in
  1436.         aix) osname=aix
  1437.             tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
  1438.             case "$tmp" in
  1439.             'not found') osvers=3.2.0 ;;
  1440.             '<3240'|'<>3240') osvers=3.2.0 ;;
  1441.             '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
  1442.             '=3250'|'>3250') osvers=3.2.5 ;;
  1443.             *) osvers='' ;;
  1444.             esac
  1445.             ;;
  1446.         dnix) osname=dnix
  1447.             osvers="$3"
  1448.             ;;
  1449.         domainos) osname=apollo
  1450.             osvers="$3"
  1451.             ;;
  1452.         dgux) osname=dgux 
  1453.             osvers="$3"
  1454.             ;;
  1455.         freebsd) osname=freebsd 
  1456.             osvers="$3" ;;
  1457.         genix) osname=genix ;;
  1458.         hp*) osname=hpux 
  1459.             case "$3" in
  1460.             *.08.*) osvers=9 ;;
  1461.             *.09.*) osvers=9 ;;
  1462.             *.10.*) osvers=10 ;;
  1463.             esac
  1464.             ;;
  1465.         irix) osname=irix
  1466.             case "$3" in
  1467.             4*) osvers=4 ;;
  1468.             5*) osvers=5 ;;
  1469.             esac
  1470.             ;;
  1471.         linux) osname=linux
  1472.             case "$3" in
  1473.             1*) osvers=1 ;;
  1474.             *)    osvers="$3" ;;
  1475.             esac
  1476.             ;;
  1477.         netbsd*) osname=netbsd 
  1478.                 osvers="$3"
  1479.                 ;;
  1480.         bsd386) osname=bsd386
  1481.             osvers=`$uname -r`
  1482.             ;;
  1483.         next*) osname=next ;;
  1484.         solaris) osname=solaris
  1485.             case "$3" in
  1486.             5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
  1487.             esac
  1488.             ;;
  1489.         sunos) osname=sunos
  1490.             case "$3" in
  1491.             5*) osname=solaris
  1492.                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
  1493.             *)    osvers="$3" ;;
  1494.             esac
  1495.             ;;
  1496.         titanos) osname=titanos
  1497.             case "$3" in
  1498.             1*) osvers=1 ;;
  1499.             2*) osvers=2 ;;
  1500.             3*) osvers=3 ;;
  1501.             4*) osvers=4 ;;
  1502.             esac
  1503.             ;;
  1504.         ultrix) osname=ultrix
  1505.             case "$3" in
  1506.             1*) osvers=1 ;;
  1507.             2*) osvers=2 ;;
  1508.             3*) osvers=3 ;;
  1509.             4*) osvers=4 ;;
  1510.             esac
  1511.             ;;
  1512.         osf1)    case "$5" in
  1513.                 alpha)  osname=dec_osf
  1514.                     case "$3" in
  1515.                         [vt]1\.*) osvers=1 ;;
  1516.                         [vt]2\.*) osvers=2 ;;
  1517.                         [vt]3\.*) osvers=3 ;;
  1518.                     esac
  1519.                     ;;
  1520.             hp*)    osname=hp_osf1    ;;    # TR
  1521.             mips)    osname=mips_osf1 ;;    # TR
  1522.             # TR =    Technology Releases: unsupported
  1523.             esac
  1524.             ;;
  1525.         uts) osname=uts 
  1526.             osvers="$3"
  1527.             ;;
  1528.         $2) case "$osname" in
  1529.             *isc*) ;;
  1530.             *freebsd*) ;;
  1531.              svr*)
  1532.                 : svr4.x or possibly later
  1533.                 case "svr$3" in    
  1534.                 ${osname}*)
  1535.                     osname=svr$3
  1536.                     osvers=$4
  1537.                     ;;
  1538.                 esac
  1539.                 case "$osname" in
  1540.                 svr4.0)
  1541.                     : Check for ESIX
  1542.                     if test -f /stand/boot ; then
  1543.                         eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
  1544.                         if test -n $INITPROG -a -f $INITPROG; then
  1545.                             isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
  1546.                             if test -n $isesix; then
  1547.                                 osname=esix4
  1548.                             fi
  1549.                         fi
  1550.                     fi
  1551.                     ;;
  1552.                 esac
  1553.                 ;;
  1554.             *)    if test -f /etc/systemid; then
  1555.                     osname=sco
  1556.                     set `echo $3 | $sed 's/\./ /g'` $4
  1557.                     if $test -f sco_$1_$2_$3.sh; then
  1558.                         osvers=$1.$2.$3
  1559.                     elif $test -f sco_$1_$2.sh; then
  1560.                         osvers=$1.$2
  1561.                     elif $test -f sco_$1.sh; then
  1562.                         osvers=$1
  1563.                     fi
  1564.                 else
  1565.                     case "$osname" in
  1566.                     '') : Still unknown.  Probably a generic Sys V.
  1567.                         osname="sysv"
  1568.                         osvers="$3"
  1569.                         ;;
  1570.                     esac
  1571.                 fi
  1572.                 ;;
  1573.             esac
  1574.             ;;
  1575.         *)    case "$osname" in
  1576.             '') : Still unknown.  Probably a generic BSD.
  1577.                 osname="$1"
  1578.                 osvers="$3"
  1579.                 ;;
  1580.             esac
  1581.             ;;
  1582.         esac
  1583.     else
  1584.         if test -f /vmunix -a -f news_os.sh; then
  1585.             (what /vmunix | tr '[A-Z]' '[a-z]') > ../UU/kernel.what 2>&1
  1586.             if $contains news-os ../UU/kernel.what >/dev/null 2>&1; then
  1587.                 osname=news_os
  1588.             fi
  1589.             $rm -f ../UU/kernel.what
  1590.         fi
  1591.     fi
  1592.     
  1593.     : Now look for a hint file osname_osvers, unless one has been
  1594.     : specified already.
  1595.     case "$hintfile" in
  1596.     ''|' ')
  1597.         file=`echo "${osname}_${osvers}" | sed -e 's@\.@_@g' -e 's@_$@@'`
  1598.         : Also try without trailing minor version numbers.
  1599.         xfile=`echo $file | sed -e 's@_[^_]*$@@'`
  1600.         xxfile=`echo $xfile | sed -e 's@_[^_]*$@@'`
  1601.         xxxfile=`echo $xxfile | sed -e 's@_[^_]*$@@'`
  1602.         xxxxfile=`echo $xxxfile | sed -e 's@_[^_]*$@@'`
  1603.         case "$file" in
  1604.         '') dflt=none ;;
  1605.         *)  case "$osvers" in
  1606.             '') dflt=$file
  1607.                 ;;
  1608.             *)  if $test -f $file.sh ; then
  1609.                     dflt=$file
  1610.                 elif $test -f $xfile.sh ; then
  1611.                     dflt=$xfile
  1612.                 elif $test -f $xxfile.sh ; then
  1613.                     dflt=$xxfile
  1614.                 elif $test -f $xxxfile.sh ; then
  1615.                     dflt=$xxxfile
  1616.                 elif $test -f $xxxxfile.sh ; then
  1617.                     dflt=$xxxxfile
  1618.                 elif $test -f "${osname}.sh" ; then
  1619.                     dflt="${osname}"
  1620.                 else
  1621.                     dflt=none
  1622.                 fi
  1623.                 ;;
  1624.             esac
  1625.             ;;
  1626.         esac
  1627.         ;;
  1628.     *)
  1629.         dflt=`echo $hintfile | sed 's/\.sh$//'`
  1630.         ;;
  1631.     esac
  1632.             
  1633.     $cat <<EOM
  1634.  
  1635. You may give one or more space-separated answers, or "none" if appropriate.
  1636. If your OS version has no hints, DO NOT give a wrong version -- say "none".
  1637.  
  1638. EOM
  1639.     rp="Which of these apply, if any?"
  1640.     . ../UU/myread
  1641.     tans=$ans
  1642.     for file in $tans; do
  1643.         if $test -f $file.sh; then
  1644.             . ./$file.sh
  1645.             $cat $file.sh >> ../UU/config.sh
  1646.         elif $test X$tans = X -o X$tans = Xnone ; then
  1647.             : nothing
  1648.         else
  1649.             : Give one chance to correct a possible typo.
  1650.             echo "$file.sh does not exist"
  1651.             dflt=$file
  1652.             rp="hint to use instead?"
  1653.             . ../UU/myread
  1654.             for file in $ans; do
  1655.                 if $test -f "$file.sh"; then
  1656.                     . ./$file.sh
  1657.                     $cat $file.sh >> ../UU/config.sh
  1658.                 elif $test X$ans = X -o X$ans = Xnone ; then
  1659.                     : nothing
  1660.                 else
  1661.                     echo "$file.sh does not exist -- ignored."
  1662.                 fi
  1663.             done
  1664.         fi
  1665.     done
  1666.  
  1667.     hint=recommended
  1668.     : Remember our hint file for later.
  1669.     if $test -f "$file.sh" ; then
  1670.         hintfile="$file"
  1671.     else
  1672.         hintfile=''
  1673.     fi
  1674.  
  1675.     cd ..
  1676. fi
  1677. cd UU
  1678. ;;
  1679. *)
  1680.     echo " "
  1681.     echo "Fetching default answers from $config_sh..." >&4
  1682.     tmp="$n"
  1683.     tans="$c"
  1684.     cd ..
  1685.     cp $config_sh config.sh 2>/dev/null
  1686.     . ./config.sh
  1687.     cd UU
  1688.     cp ../config.sh .
  1689.     n="$tmp"
  1690.     c="$tans"
  1691.     hint=previous
  1692.     ;;
  1693. esac
  1694.  
  1695. : Restore computed paths
  1696. for file in $loclist $trylist; do
  1697.     eval $file="\$_$file"
  1698. done
  1699.  
  1700. cat << EOM
  1701.  
  1702. Configure uses the operating system name and version to set some defaults.
  1703. Say "none" to leave it blank.
  1704.  
  1705. EOM
  1706.  
  1707. case "$osname" in
  1708.     ''|' ')
  1709.         case "$hintfile" in
  1710.         ''|' '|none) dflt=none ;;
  1711.         *)  dflt=`echo $hintfile | sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
  1712.         esac
  1713.         ;;
  1714.     *) dflt="$osname" ;;
  1715. esac
  1716. rp="Operating system name?"
  1717. . ./myread
  1718. case "$ans" in
  1719.     none)  osname='' ;;
  1720.     *) osname="$ans" ;;
  1721. esac
  1722. : who configured the system
  1723. cf_time=`$date 2>&1`
  1724. (logname > .temp) >/dev/null 2>&1
  1725. $test -s .temp || (whoami > .temp) >/dev/null 2>&1
  1726. $test -s .temp || echo unknown > .temp
  1727. cf_by=`$cat .temp`
  1728. $rm -f .temp
  1729.  
  1730. : determine where manual pages are on this system
  1731. echo " "
  1732. case "$sysman" in
  1733. '') 
  1734.     syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
  1735.     syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
  1736.     syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
  1737.     syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
  1738.     syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
  1739.     sysman=`./loc . /usr/man/man1 $syspath`
  1740.     ;;
  1741. esac
  1742. if $test -d "$sysman"; then
  1743.     echo "System manual is in $sysman." >&4
  1744. else
  1745.     echo "Could not find manual pages in source form." >&4
  1746. fi
  1747.  
  1748. : see what memory models we can support
  1749. case "$models" in
  1750. '')
  1751.     $cat >pdp11.c <<'EOP'
  1752. main() {
  1753. #ifdef pdp11
  1754.     exit(0);
  1755. #else
  1756.     exit(1);
  1757. #endif
  1758. }
  1759. EOP
  1760.     cc -o pdp11 pdp11.c >/dev/null 2>&1
  1761.     if ./pdp11 2>/dev/null; then
  1762.         dflt='unsplit split'
  1763.     else
  1764.         tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
  1765.         case "$tans" in
  1766.         X) dflt='none';;
  1767.         *) if $test -d /lib/small || $test -d /usr/lib/small; then
  1768.                 dflt='small'
  1769.             else
  1770.                 dflt=''
  1771.             fi
  1772.             if $test -d /lib/medium || $test -d /usr/lib/medium; then
  1773.                 dflt="$dflt medium"
  1774.             fi
  1775.             if $test -d /lib/large || $test -d /usr/lib/large; then
  1776.                 dflt="$dflt large"
  1777.             fi
  1778.             if $test -d /lib/huge || $test -d /usr/lib/huge; then
  1779.                 dflt="$dflt huge"
  1780.             fi
  1781.         esac
  1782.     fi;;
  1783. *) dflt="$models";;
  1784. esac
  1785. $cat <<EOM
  1786.  
  1787. Some systems have different model sizes.  On most systems they are called
  1788. small, medium, large, and huge.  On the PDP11 they are called unsplit and
  1789. split.  If your system doesn't support different memory models, say "none".
  1790. If you wish to force everything to one memory model, say "none" here and
  1791. put the appropriate flags later when it asks you for other cc and ld flags.
  1792. Venix systems may wish to put "none" and let the compiler figure things out.
  1793. (In the following question multiple model names should be space separated.)
  1794.  
  1795. EOM
  1796. rp="Which memory models are supported?"
  1797. . ./myread
  1798. models="$ans"
  1799.  
  1800. case "$models" in
  1801. none)
  1802.     small=''
  1803.     medium=''
  1804.     large=''
  1805.     huge=''
  1806.     unsplit=''
  1807.     split=''
  1808.     ;;
  1809. *split)
  1810.     case "$split" in
  1811.     '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
  1812.              $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
  1813.             dflt='-i'
  1814.         else
  1815.             dflt='none'
  1816.         fi;;
  1817.     *) dflt="$split";;
  1818.     esac
  1819.     rp="What flag indicates separate I and D space?"
  1820.     . ./myread
  1821.     tans="$ans"
  1822.     case "$tans" in
  1823.     none) tans='';;
  1824.     esac
  1825.     split="$tans"
  1826.     unsplit='';;
  1827. *large*|*small*|*medium*|*huge*)
  1828.     case "$models" in
  1829.     *large*)
  1830.         case "$large" in
  1831.         '') dflt='-Ml';;
  1832.         *) dflt="$large";;
  1833.         esac
  1834.     rp="What flag indicates large model?"
  1835.     . ./myread
  1836.     tans="$ans"
  1837.     case "$tans" in
  1838.     none) tans='';
  1839.     esac
  1840.     large="$tans";;
  1841.     *) large='';;
  1842.     esac
  1843.     case "$models" in
  1844.     *huge*) case "$huge" in
  1845.         '') dflt='-Mh';;
  1846.         *) dflt="$huge";;
  1847.         esac
  1848.         rp="What flag indicates huge model?"
  1849.         . ./myread
  1850.         tans="$ans"
  1851.         case "$tans" in
  1852.         none) tans='';
  1853.         esac
  1854.         huge="$tans";;
  1855.     *) huge="$large";;
  1856.     esac
  1857.     case "$models" in
  1858.     *medium*) case "$medium" in
  1859.         '') dflt='-Mm';;
  1860.         *) dflt="$medium";;
  1861.         esac
  1862.         rp="What flag indicates medium model?"
  1863.         . ./myread
  1864.         tans="$ans"
  1865.         case "$tans" in
  1866.         none) tans='';
  1867.         esac
  1868.         medium="$tans";;
  1869.     *) medium="$large";;
  1870.     esac
  1871.     case "$models" in
  1872.     *small*) case "$small" in
  1873.         '') dflt='none';;
  1874.         *) dflt="$small";;
  1875.         esac
  1876.         rp="What flag indicates small model?"
  1877.         . ./myread
  1878.         tans="$ans"
  1879.         case "$tans" in
  1880.         none) tans='';
  1881.         esac
  1882.         small="$tans";;
  1883.     *) small='';;
  1884.     esac
  1885.     ;;
  1886. *)
  1887.     echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
  1888.     ;;
  1889. esac
  1890.  
  1891. : make some quick guesses about what we are up against
  1892. echo " "
  1893. $echo $n "Hmm...  $c"
  1894. echo exit 1 >bsd
  1895. echo exit 1 >usg
  1896. echo exit 1 >v7
  1897. echo exit 1 >osf1
  1898. echo exit 1 >eunice
  1899. echo exit 1 >xenix
  1900. echo exit 1 >venix
  1901. $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
  1902. if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
  1903. then
  1904.     echo "Looks kind of like an OSF/1 system, but we'll see..."
  1905.     echo exit 0 >osf1
  1906. elif test `echo abc | tr a-z A-Z` = Abc ; then
  1907.     xxx=`./loc addbib blurfl $pth`
  1908.     if $test -f $xxx; then
  1909.     echo "Looks kind of like a USG system with BSD features, but we'll see..."
  1910.         echo exit 0 >bsd
  1911.         echo exit 0 >usg
  1912.     else
  1913.         if $contains SIGTSTP foo >/dev/null 2>&1 ; then
  1914.             echo "Looks kind of like an extended USG system, but we'll see..."
  1915.         else
  1916.             echo "Looks kind of like a USG system, but we'll see..."
  1917.         fi
  1918.         echo exit 0 >usg
  1919.     fi
  1920. elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
  1921.     echo "Looks kind of like a BSD system, but we'll see..."
  1922.     echo exit 0 >bsd
  1923. else
  1924.     echo "Looks kind of like a Version 7 system, but we'll see..."
  1925.     echo exit 0 >v7
  1926. fi
  1927. case "$eunicefix" in
  1928. *unixtovms*)
  1929.     $cat <<'EOI'
  1930. There is, however, a strange, musty smell in the air that reminds me of
  1931. something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
  1932. EOI
  1933.     echo exit 0 >eunice
  1934.     d_eunice="$define"
  1935. : it so happens the Eunice I know will not run shell scripts in Unix format
  1936.     ;;
  1937. *)
  1938.     echo " "
  1939.     echo "Congratulations.  You aren't running Eunice."
  1940.     d_eunice="$undef"
  1941.     ;;
  1942. esac
  1943. if test -f /xenix; then
  1944.     echo "Actually, this looks more like a XENIX system..."
  1945.     echo exit 0 >xenix
  1946.     d_xenix="$define"
  1947. else
  1948.     echo " "
  1949.     echo "It's not Xenix..."
  1950.     d_xenix="$undef"
  1951. fi
  1952. chmod +x xenix
  1953. $eunicefix xenix
  1954. if test -f /venix; then
  1955.     echo "Actually, this looks more like a VENIX system..."
  1956.     echo exit 0 >venix
  1957. else
  1958.     echo " "
  1959.     if xenix; then
  1960.         : null
  1961.     else
  1962.         echo "Nor is it Venix..."
  1963.     fi
  1964. fi
  1965. chmod +x bsd usg v7 osf1 eunice xenix venix
  1966. $eunicefix bsd usg v7 osf1 eunice xenix venix
  1967. $rm -f foo
  1968.  
  1969. : see if we need a special compiler
  1970. echo " "
  1971. if usg; then
  1972.     case "$cc" in
  1973.     '') case "$Mcc" in
  1974.         /*) dflt='Mcc';;
  1975.         *) case "$large" in
  1976.             -M*) dflt='cc';;
  1977.             *)    if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
  1978.                     if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
  1979.                         dflt='cc'
  1980.                     else
  1981.                         dflt='cc -M'
  1982.                     fi
  1983.                 else
  1984.                     dflt='cc'
  1985.                 fi;;
  1986.             esac;;
  1987.         esac;;
  1988.     *)  dflt="$cc";;
  1989.     esac
  1990.     $cat <<'EOM'
  1991. On some systems the default C compiler will not resolve multiple global
  1992. references that happen to have the same name.  On some such systems the "Mcc"
  1993. command may be used to force these to be resolved.  On other systems a "cc -M"
  1994. command is required.  (Note that the -M flag on other systems indicates a
  1995. memory model to use!) If you have the Gnu C compiler, you might wish to use
  1996. that instead.
  1997.  
  1998. EOM
  1999.     rp="What command will force resolution on this system?"
  2000.     . ./myread
  2001.     cc="$ans"
  2002. else
  2003.     case "$cc" in
  2004.     '') dflt=cc;;
  2005.     *) dflt="$cc";;
  2006.     esac
  2007.     rp="Use which C compiler?"
  2008.     . ./myread
  2009.     cc="$ans"
  2010. fi
  2011. echo "Checking if you are using GNU cc ..." >&4
  2012. $cat >gccvers.c <<EOM
  2013. #include <stdio.h>
  2014. int main() {
  2015. #ifdef __GNUC__
  2016. #ifdef __VERSION__
  2017. printf("%s\n", __VERSION__);
  2018. #else
  2019. printf("%s\n", "1");
  2020. #endif
  2021. #endif
  2022. return 0;
  2023. }
  2024. EOM
  2025. if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
  2026.     gccversion=`./gccvers`
  2027.     case "$gccversion" in
  2028.     '') echo "You are not using GNU cc." ;;
  2029.     *)  echo "You are using GNU cc $gccversion." ;;
  2030.     esac
  2031. else
  2032.     echo "I can't compile the test program.  I'll assume it's not GNU cc."
  2033. fi
  2034. $rm -f gccvers*
  2035. case "$gccversion" in
  2036. 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
  2037. esac
  2038.  
  2039. : decide how portable to be
  2040. case "$d_portable" in
  2041. "$define") dflt=y;;
  2042. *)    dflt=n;;
  2043. esac
  2044. $cat <<'EOH'
  2045.  
  2046. I can set things up so that your shell scripts and binaries are more portable,
  2047. at what may be a noticable cost in performance.  In particular, if you
  2048. ask to be portable, the following happens:
  2049.  
  2050.      1) Shell scripts will rely on the PATH variable rather than using
  2051.     the paths derived above.
  2052.      2) ~username interpretations will be done at run time rather than
  2053.     by Configure.
  2054.  
  2055. EOH
  2056. rp="Do you expect to run these scripts and binaries on multiple machines?"
  2057. . ./myread
  2058. case "$ans" in
  2059.     y*) d_portable="$define"
  2060.     for file in $loclist $trylist; do
  2061.         eval $file="\$file"
  2062.     done
  2063.     ;;
  2064.     *)  d_portable="$undef" ;;
  2065. esac
  2066.  
  2067. : set up shell script to do ~ expansion
  2068. cat >filexp <<EOSS
  2069. $startsh
  2070. : expand filename
  2071. case "\$1" in
  2072.  ~/*|~)
  2073.     echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
  2074.     ;;
  2075.  ~*)
  2076.     if $test -f /bin/csh; then
  2077.         /bin/csh -f -c "glob \$1"
  2078.         failed=\$?
  2079.         echo ""
  2080.         exit \$failed
  2081.     else
  2082.         name=\`$expr x\$1 : '..\([^/]*\)'\`
  2083.         dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
  2084.         if $test ! -d "\$dir"; then
  2085.             me=\`basename \$0\`
  2086.             echo "\$me: can't locate home directory for: \$name" >&2
  2087.             exit 1
  2088.         fi
  2089.         case "\$1" in
  2090.         */*)
  2091.             echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
  2092.             ;;
  2093.         *)
  2094.             echo \$dir
  2095.             ;;
  2096.         esac
  2097.     fi
  2098.     ;;
  2099. *)
  2100.     echo \$1
  2101.     ;;
  2102. esac
  2103. EOSS
  2104. chmod +x filexp
  2105. $eunicefix filexp
  2106.  
  2107. : now set up to get a file name
  2108. cat <<'EOSC' >getfile
  2109. tilde=''
  2110. fullpath=''
  2111. already=''
  2112. skip=''
  2113. none_ok=''
  2114. exp_file=''
  2115. nopath_ok=''
  2116. orig_rp="$rp"
  2117. orig_dflt="$dflt"
  2118.  
  2119. case "$fn" in
  2120. *:*)
  2121.     loc_file=`expr $fn : '.*:\(.*\)'`
  2122.     fn=`expr $fn : '\(.*\):.*'`
  2123.     ;;
  2124. esac
  2125.  
  2126. case "$fn" in
  2127. *~*) tilde=true;;
  2128. esac
  2129. case "$fn" in
  2130. */*) fullpath=true;;
  2131. esac
  2132. case "$fn" in
  2133. *+*) skip=true;;
  2134. esac
  2135. case "$fn" in
  2136. *n*) none_ok=true;;
  2137. esac
  2138. case "$fn" in
  2139. *e*) exp_file=true;;
  2140. esac
  2141. case "$fn" in
  2142. *p*) nopath_ok=true;;
  2143. esac
  2144.  
  2145. case "$fn" in
  2146. *f*) type='File';;
  2147. *d*) type='Directory';;
  2148. *l*) type='Locate';;
  2149. esac
  2150.  
  2151. what="$type"
  2152. case "$what" in
  2153. Locate) what='File';;
  2154. esac
  2155.  
  2156. case "$exp_file" in
  2157. '')
  2158.     case "$d_portable" in
  2159.     "$define") ;;
  2160.     *) exp_file=true;;
  2161.     esac
  2162.     ;;
  2163. esac
  2164.  
  2165. cd ..
  2166. while test "$type"; do
  2167.     redo=''
  2168.     rp="$orig_rp"
  2169.     dflt="$orig_dflt"
  2170.     case "$tilde" in
  2171.     true) rp="$rp (~name ok)";;
  2172.     esac
  2173.     . UU/myread
  2174.     case "$ans" in
  2175.     none)
  2176.         value=''
  2177.         ansexp=''
  2178.         case "$none_ok" in
  2179.         true) type='';;
  2180.         esac
  2181.         ;;
  2182.     *)
  2183.         case "$tilde" in
  2184.         '') value="$ans"
  2185.             ansexp="$ans";;
  2186.         *)
  2187.             value=`UU/filexp $ans`
  2188.             case $? in
  2189.             0)
  2190.                 if test "$ans" != "$value"; then
  2191.                     echo "(That is $value on this particular system.)"
  2192.                 fi
  2193.                 ;;
  2194.             *) value="$ans";;
  2195.             esac
  2196.             ansexp="$value"
  2197.             case "$exp_file" in
  2198.             '') value="$ans";;
  2199.             esac
  2200.             ;;
  2201.         esac
  2202.         case "$fullpath" in
  2203.         true)
  2204.             case "$ansexp" in
  2205.             /*) value="$ansexp" ;;
  2206.             *)
  2207.                 redo=true
  2208.                 case "$already" in
  2209.                 true)
  2210.                 echo "I shall only accept a full path name, as in /bin/ls." >&4
  2211.                 echo "Use a ! shell escape if you wish to check pathnames." >&4
  2212.                     ;;
  2213.                 *)
  2214.                 echo "Please give a full path name, starting with slash." >&4
  2215.                     case "$tilde" in
  2216.                     true)
  2217.                 echo "Note that using ~name is ok provided it expands well." >&4
  2218.                         already=true
  2219.                         ;;
  2220.                     esac
  2221.                 esac
  2222.                 ;;
  2223.             esac
  2224.             ;;
  2225.         esac
  2226.         case "$redo" in
  2227.         '')
  2228.             case "$type" in
  2229.             File)
  2230.                 if test -f "$ansexp"; then
  2231.                     type=''
  2232.                 elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
  2233.                 then
  2234.                     echo "($value is not a plain file, but that's ok.)"
  2235.                     type=''
  2236.                 fi
  2237.                 ;;
  2238.             Directory)
  2239.                 if test -d "$ansexp"; then
  2240.                     type=''
  2241.                 fi
  2242.                 ;;
  2243.             Locate)
  2244.                 if test -d "$value"; then
  2245.                     echo "(Looking for $loc_file in directory $value.)"
  2246.                     value="$value/$loc_file"
  2247.                 fi
  2248.                 if test -f "$value"; then
  2249.                     type=''
  2250.                 fi
  2251.                 case "$nopath_ok" in
  2252.                 true)    case "$value" in
  2253.                     */*) ;;
  2254.                     *)    echo "Assuming $value will be in people's path."
  2255.                         type=''
  2256.                         ;;
  2257.                     esac
  2258.                     ;;
  2259.                 esac
  2260.                 ;;
  2261.             esac
  2262.  
  2263.             case "$skip" in
  2264.             true) type='';
  2265.             esac
  2266.  
  2267.             case "$type" in
  2268.             '') ;;
  2269.             *)
  2270.                 if test "$fastread" = yes; then
  2271.                     dflt=y
  2272.                 else
  2273.                     dflt=n
  2274.                 fi
  2275.                 rp="$what $value doesn't exist.  Use that name anyway?"
  2276.                 . UU/myread
  2277.                 dflt=''
  2278.                 case "$ans" in
  2279.                 y*) type='';;
  2280.                 *) echo " ";;
  2281.                 esac
  2282.                 ;;
  2283.             esac
  2284.             ;;
  2285.         esac
  2286.         ;;
  2287.     esac
  2288. done
  2289. cd UU
  2290. ans="$value"
  2291. rp="$orig_rp"
  2292. dflt="$orig_dflt"
  2293. EOSC
  2294.  
  2295. : What should the include directory be ?
  2296. echo " "
  2297. $echo $n "Hmm...  $c"
  2298. dflt='/usr/include'
  2299. incpath=''
  2300. mips_type=''
  2301. if $test -f /bin/mips && /bin/mips; then
  2302.     echo "Looks like a MIPS system..."
  2303.     $cat >usr.c <<'EOCP'
  2304. #ifdef SYSTYPE_BSD43
  2305. /bsd43
  2306. #endif
  2307. EOCP
  2308.     if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
  2309.         dflt='/bsd43/usr/include'
  2310.         incpath='/bsd43'
  2311.         mips_type='BSD 4.3'
  2312.     else
  2313.         mips_type='System V'
  2314.     fi
  2315.     $rm -f usr.c usr.out
  2316.     echo "and you're compiling with the $mips_type compiler and libraries."
  2317. else
  2318.     echo "Doesn't look like a MIPS system."
  2319.     echo "exit 1" >mips
  2320.     chmod +x mips
  2321.     $eunicefix mips
  2322. fi
  2323. echo " "
  2324. case "$usrinc" in
  2325. '') ;;
  2326. *) dflt="$usrinc";;
  2327. esac
  2328. fn=d/
  2329. rp='Where are the include files you want to use?'
  2330. . ./getfile
  2331. usrinc="$ans"
  2332.  
  2333. : see how we invoke the C preprocessor
  2334. echo " "
  2335. echo "Now, how can we feed standard input to your C preprocessor..." >&4
  2336. cat <<'EOT' >testcpp.c
  2337. #define ABC abc
  2338. #define XYZ xyz
  2339. ABC.XYZ
  2340. EOT
  2341. cd ..
  2342. echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
  2343. chmod 755 cppstdin
  2344. wrapper=`pwd`/cppstdin
  2345. ok='false'
  2346. cd UU
  2347.  
  2348. if $test "X$cppstdin" != "X" && \
  2349.     $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
  2350.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
  2351. then
  2352.     echo "You used to use $cppstdin $cppminus so we'll use that again."
  2353.     case "$cpprun" in
  2354.     '') echo "But let's see if we can live without a wrapper..." ;;
  2355.     *)
  2356.         if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
  2357.             $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
  2358.         then
  2359.             echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
  2360.             ok='true'
  2361.         else
  2362.             echo "(However, $cpprun $cpplast does not work, let's see...)"
  2363.         fi
  2364.         ;;
  2365.     esac
  2366. else
  2367.     case "$cppstdin" in
  2368.     '') ;;
  2369.     *)
  2370.         echo "Good old $cppstdin $cppminus does not seem to be of any help..."
  2371.         ;;
  2372.     esac
  2373. fi
  2374.  
  2375. if $ok; then
  2376.     : nothing
  2377. elif echo 'Maybe "'"$cc"' -E" will work...'; \
  2378.     $cc -E <testcpp.c >testcpp.out 2>&1; \
  2379.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  2380.     echo "Yup, it does."
  2381.     x_cpp="$cc -E"
  2382.     x_minus='';
  2383. elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
  2384.     $cc -E - <testcpp.c >testcpp.out 2>&1; \
  2385.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  2386.     echo "Yup, it does."
  2387.     x_cpp="$cc -E"
  2388.     x_minus='-';
  2389. elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
  2390.     $cc -P <testcpp.c >testcpp.out 2>&1; \
  2391.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  2392.     echo "Yipee, that works!"
  2393.     x_cpp="$cc -P"
  2394.     x_minus='';
  2395. elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
  2396.     $cc -P - <testcpp.c >testcpp.out 2>&1; \
  2397.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  2398.     echo "At long last!"
  2399.     x_cpp="$cc -P"
  2400.     x_minus='-';
  2401. elif echo 'No such luck, maybe "'$cpp'" will work...'; \
  2402.     $cpp <testcpp.c >testcpp.out 2>&1; \
  2403.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  2404.     echo "It works!"
  2405.     x_cpp="$cpp"
  2406.     x_minus='';
  2407. elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
  2408.     $cpp - <testcpp.c >testcpp.out 2>&1; \
  2409.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  2410.     echo "Hooray, it works!  I was beginning to wonder."
  2411.     x_cpp="$cpp"
  2412.     x_minus='-';
  2413. elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
  2414.     $wrapper <testcpp.c >testcpp.out 2>&1; \
  2415.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  2416.     x_cpp="$wrapper"
  2417.     x_minus=''
  2418.     echo "Eureka!"
  2419. else
  2420.     dflt=''
  2421.     rp="No dice.  I can't find a C preprocessor.  Name one:"
  2422.     . ./myread
  2423.     x_cpp="$ans"
  2424.     x_minus=''
  2425.     $x_cpp <testcpp.c >testcpp.out 2>&1
  2426.     if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  2427.         echo "OK, that will do." >&4
  2428.     else
  2429. echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
  2430.         exit 1
  2431.     fi
  2432. fi
  2433.  
  2434. case "$ok" in
  2435. false)
  2436.     cppstdin="$x_cpp"
  2437.     cppminus="$x_minus"
  2438.     cpprun="$x_cpp"
  2439.     cpplast="$x_minus"
  2440.     set X $x_cpp
  2441.     shift
  2442.     case "$1" in
  2443.     "$cpp")
  2444.         echo "Perhaps can we force $cc -E using a wrapper..."
  2445.         if $wrapper <testcpp.c >testcpp.out 2>&1; \
  2446.             $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
  2447.         then
  2448.             echo "Yup, we can."
  2449.             cppstdin="$wrapper"
  2450.             cppminus='';
  2451.         else
  2452.             echo "Nope, we'll have to live without it..."
  2453.         fi
  2454.         ;;
  2455.     esac
  2456.     case "$cpprun" in
  2457.     "$wrapper")
  2458.         cpprun=''
  2459.         cpplast=''
  2460.         ;;
  2461.     esac
  2462.     ;;
  2463. esac
  2464.  
  2465. case "$cppstdin" in
  2466. "$wrapper") ;;
  2467. *) $rm -f $wrapper;;
  2468. esac
  2469. $rm -f testcpp.c testcpp.out
  2470.  
  2471. : determine optimize, if desired, or use for debug flag also
  2472. case "$optimize" in
  2473. ' ') dflt='none';;
  2474. '') dflt='-O';;
  2475. *) dflt="$optimize";;
  2476. esac
  2477. $cat <<EOH
  2478.  
  2479. Some C compilers have problems with their optimizers, by default, $package
  2480. compiles with the -O flag to use the optimizer.  Alternately, you might want
  2481. to use the symbolic debugger, which uses the -g flag (on traditional Unix
  2482. systems).  Either flag can be specified here.  To use neither flag, specify
  2483. the word "none".
  2484.  
  2485. EOH
  2486. rp="What optimizer/debugger flag should be used?"
  2487. . ./myread
  2488. optimize="$ans"
  2489. case "$optimize" in
  2490. 'none') optimize=" ";;
  2491. esac
  2492.  
  2493. dflt=''
  2494. case "$ccflags" in
  2495. '')    
  2496.     case "$gccversion" in
  2497.     1*) dflt='-fpcc-struct-return' ;;
  2498.     esac
  2499.     case "$optimize" in
  2500.     *-g*) dflt="$dflt -DDEBUGGING";;
  2501.     esac
  2502.     case "$gccversion" in
  2503.     2*) if test -d /etc/conf/kconfig.d &&
  2504.             $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
  2505.         then
  2506.             dflt="$dflt -posix"
  2507.         fi
  2508.         ;;
  2509.     esac
  2510.     ;;
  2511. esac
  2512.  
  2513. case "$mips_type" in
  2514. *BSD*) ;;
  2515. '') ;;
  2516. *) inclwanted="$inclwanted $usrinc/bsd";;
  2517. esac
  2518. for thisincl in $inclwanted; do
  2519.     if $test -d $thisincl; then
  2520.         if $test x$thisincl != x$usrinc; then
  2521.             case "$dflt" in
  2522.             *$thisincl*);;
  2523.             *) dflt="$dflt -I$thisincl";;
  2524.             esac
  2525.         fi
  2526.     fi
  2527. done
  2528.  
  2529. inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
  2530.     xxx=true;
  2531. elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
  2532.     xxx=true;
  2533. else
  2534.     xxx=false;
  2535. fi;
  2536. if $xxx; then
  2537.     case "$dflt" in
  2538.     *$2*);;
  2539.     *) dflt="$dflt -D$2";;
  2540.     esac;
  2541. fi'
  2542.  
  2543. if ./osf1; then
  2544.     set signal.h __LANGUAGE_C__; eval $inctest
  2545. else
  2546.     set signal.h LANGUAGE_C; eval $inctest
  2547. fi
  2548. set signal.h NO_PROTOTYPE; eval $inctest
  2549. set signal.h _NO_PROTO; eval $inctest
  2550.  
  2551. case "$dflt" in
  2552. '') dflt=none;;
  2553. esac
  2554. case "$ccflags" in
  2555. '') ;;
  2556. *) dflt="$ccflags";;
  2557. esac
  2558. $cat <<EOH
  2559.  
  2560. Your C compiler may want other flags.  For this question you should include
  2561. -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
  2562. but you should NOT include libraries or ld flags like -lwhatever.  If you
  2563. want $package to honor its debug switch, you should include -DDEBUGGING here.
  2564. Your C compiler might also need additional flags, such as -D_POSIX_SOURCE,
  2565. -DHIDEMYMALLOC or -DCRIPPLED_CC.
  2566.  
  2567. To use no flags, specify the word "none".
  2568.  
  2569. EOH
  2570. set X $dflt
  2571. shift
  2572. dflt=${1+"$@"}
  2573. rp="Any additional cc flags?"
  2574. . ./myread
  2575. case "$ans" in
  2576. none) ccflags='';;
  2577. *) ccflags="$ans";;
  2578. esac
  2579.  
  2580. : the following weeds options from ccflags that are of no interest to cpp
  2581. cppflags="$ccflags"
  2582. case "$gccversion" in
  2583. 1*) cppflags="$cppflags -D__GNUC__"
  2584. esac
  2585. case "$mips_type" in
  2586. '');;
  2587. *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
  2588. esac
  2589. case "$cppflags" in
  2590. '');;
  2591. *)
  2592.     echo " "
  2593.     echo "Let me guess what the preprocessor flags are..." >&4
  2594.     set X $cppflags
  2595.     shift
  2596.     cppflags=''
  2597.     $cat >cpp.c <<'EOM'
  2598. #define BLURFL foo
  2599.  
  2600. BLURFL xx LFRULB
  2601. EOM
  2602.     previous=''
  2603.     for flag in $*
  2604.     do
  2605.         case "$flag" in
  2606.         -*) ftry="$flag";;
  2607.         *) ftry="$previous $flag";;
  2608.         esac
  2609.         if $cppstdin -DLFRULB=bar $ftry $cppminus <cpp.c \
  2610.             >cpp1.out 2>/dev/null && \
  2611.             $cpprun -DLFRULB=bar $ftry $cpplast <cpp.c \
  2612.             >cpp2.out 2>/dev/null && \
  2613.             $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
  2614.             $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
  2615.         then
  2616.             cppflags="$cppflags $ftry"
  2617.             previous=''
  2618.         else
  2619.             previous="$flag"
  2620.         fi
  2621.     done
  2622.     set X $cppflags
  2623.     shift
  2624.     cppflags=${1+"$@"}
  2625.     case "$cppflags" in
  2626.     *-*)  echo "They appear to be: $cppflags";;
  2627.     esac
  2628.     $rm -f cpp.c cpp?.out
  2629.     ;;
  2630. esac
  2631.  
  2632. : flags used in final linking phase
  2633. case "$ldflags" in
  2634. '') if venix; then
  2635.         dflt='-i -z'
  2636.     else
  2637.         dflt=''
  2638.     fi
  2639.     case "$ccflags" in
  2640.     *-posix*) dflt="$dflt -posix" ;;
  2641.     esac
  2642.     case "$dflt" in
  2643.     '') dflt='none' ;;
  2644.     esac
  2645.     ;;
  2646. *) dflt="$ldflags";;
  2647. esac
  2648. echo " "
  2649. rp="Any additional ld flags (NOT including libraries)?"
  2650. . ./myread
  2651. case "$ans" in
  2652. none) ldflags='';;
  2653. *) ldflags="$ans";;
  2654. esac
  2655. rmlist="$rmlist pdp11"
  2656.  
  2657. : Set private lib path
  2658. case "$plibpth" in
  2659. '') if mips; then
  2660.         plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
  2661.     fi;;
  2662. esac
  2663. case "$libpth" in
  2664. ' ') dlist='';;
  2665. '') dlist="$plibpth $glibpth";;
  2666. *) dlist="$libpth";;
  2667. esac
  2668.  
  2669. : Now check and see which directories actually exist, avoiding duplicates
  2670. libpth=''
  2671. for xxx in $dlist
  2672. do
  2673.     if $test -d $xxx; then
  2674.         case " $libpth " in
  2675.         *" $xxx "*) ;;
  2676.         *) libpth="$libpth $xxx";;
  2677.         esac
  2678.     fi
  2679. done
  2680. $cat <<'EOM'
  2681.  
  2682. Some systems have incompatible or broken versions of libraries.  Among
  2683. the directories listed in the question below, please remove any you
  2684. know not to be holding relevant libraries, and add any that are needed.
  2685. Say "none" for none.
  2686.  
  2687. EOM
  2688. case "$libpth" in
  2689. '') dflt='none';;
  2690. *)
  2691.     set X $libpth
  2692.     shift
  2693.     dflt=${1+"$@"}
  2694.     ;;
  2695. esac
  2696. rp="Directories to use for library searches?"
  2697. . ./myread
  2698. case "$ans" in
  2699. none) libpth=' ';;
  2700. *) libpth="$ans";;
  2701. esac
  2702.  
  2703. : compute shared library extension
  2704. case "$so" in
  2705. '')
  2706.     if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
  2707.         dflt='sl'
  2708.     else
  2709.         dflt='so'
  2710.     fi
  2711.     ;;
  2712. *) dflt="$so";;
  2713. esac
  2714. $cat << EOM
  2715.  
  2716. On some systems, shared libraries may be available.  Answer 'none' if
  2717. you want to suppress searching of shared libraries.
  2718. EOM
  2719. rp='What is the file extension used for shared libraries?'
  2720. . ./myread
  2721. so="$ans"
  2722.  
  2723. : Looking for optional libraries
  2724. echo " "
  2725. echo "Checking for optional libraries..." >&4
  2726. case "$libs" in
  2727. ' '|'') dflt='';;
  2728. *) dflt="$libs";;
  2729. esac
  2730. case "$libswanted" in
  2731. '') libswanted='c_s';;
  2732. esac
  2733. for thislib in $libswanted; do
  2734.     
  2735.     if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`; $test -f "$xxx"; then
  2736.         echo "Found -l$thislib (shared)."
  2737.         case " $dflt " in
  2738.         *"-l$thislib "*);;
  2739.         *) dflt="$dflt -l$thislib";;
  2740.         esac
  2741.     elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
  2742.         echo "Found -l$thislib (shared)."
  2743.         case " $dflt " in
  2744.         *"-l$thislib "*);;
  2745.         *) dflt="$dflt -l$thislib";;
  2746.         esac
  2747.     elif xxx=`./loc lib$thislib.a X $libpth`; $test -f "$xxx"; then
  2748.         echo "Found -l$thislib."
  2749.         case " $dflt " in
  2750.         *"-l$thislib "*);;
  2751.         *) dflt="$dflt -l$thislib";;
  2752.         esac
  2753.     elif xxx=`./loc lib${thislib}_s.a X $libpth`; $test -f "$xxx"; then
  2754.         echo "Found -l${thislib}_s."
  2755.         case " $dflt " in
  2756.         *"-l$thislib "*);;
  2757.         *) dflt="$dflt -l${thislib}_s";;
  2758.         esac
  2759.     elif xxx=`./loc Slib$thislib.a X $xlibpth`; $test -f "$xxx"; then
  2760.         echo "Found -l$thislib."
  2761.         case " $dflt " in
  2762.         *"-l$thislib "*);;
  2763.         *) dflt="$dflt -l$thislib";;
  2764.         esac
  2765.     else
  2766.         echo "No -l$thislib."
  2767.     fi
  2768. done
  2769. set X $dflt
  2770. shift
  2771. dflt="$*"
  2772. case "$libs" in
  2773. '') dflt="$dflt";;
  2774. *) dflt="$libs";;
  2775. esac
  2776. case "$dflt" in
  2777. ' '|'') dflt='none';;
  2778. esac
  2779.  
  2780. $cat <<EOM
  2781.  
  2782. Some versions of Unix support shared libraries, which make executables smaller
  2783. but make load time slightly longer.
  2784.  
  2785. On some systems, mostly newer Unix System V's, the shared library is included
  2786. by putting the option "-lc_s" as the last thing on the cc command line when
  2787. linking.  Other systems use shared libraries by default.  There may be other
  2788. libraries needed to compile $package on your machine as well.  If your system
  2789. needs the "-lc_s" option, include it here.  Include any other special libraries
  2790. here as well.  Say "none" for none.
  2791. EOM
  2792.  
  2793. echo " "
  2794. rp="Any additional libraries?"
  2795. . ./myread
  2796. case "$ans" in
  2797. none) libs=' ';;
  2798. *) libs="$ans";;
  2799. esac
  2800.  
  2801. : see if nm is to be used to determine whether a symbol is defined or not
  2802. case "$usenm" in
  2803. '')
  2804.     dflt=`egrep 'inlibc|csym' ../Configure | wc -l 2>/dev/null`
  2805.     if $test $dflt -gt 20; then
  2806.         dflt=y
  2807.     else
  2808.         dflt=n
  2809.     fi
  2810.     ;;
  2811. *)
  2812.     case "$usenm" in
  2813.     true) dflt=y;;
  2814.     *) dflt=n;;
  2815.     esac
  2816.     ;;
  2817. esac
  2818. $cat <<EOM
  2819.  
  2820. I can use 'nm' to extract the symbols from your C libraries. This is a time
  2821. consuming task which may generate huge output on the disk (up to 3 megabytes)
  2822. but that should make the symbols extraction faster. The alternative is to skip
  2823. the 'nm' extraction part and to compile a small test program instead to
  2824. determine whether each symbol is present. If you have a fast C compiler and/or
  2825. if your 'nm' output cannot be parsed, this may be the best solution.
  2826.  
  2827. EOM
  2828. rp='Shall I use nm to extract C symbols from the libraries?'
  2829. . ./myread
  2830. case "$ans" in
  2831. n|N) usenm=false;;
  2832. *) usenm=true;;
  2833. esac
  2834.  
  2835. runnm=$usenm
  2836. case "$reuseval" in
  2837. true) runnm=false;;
  2838. esac
  2839.  
  2840. : nm options which may be necessary
  2841. case "$nm_opt" in
  2842. '') if $test -f /mach_boot; then
  2843.         nm_opt=''
  2844.     elif $test -d /usr/ccs/lib; then
  2845.         nm_opt='-p'
  2846.     elif $test -f /dgux; then
  2847.         nm_opt='-p'
  2848.     else
  2849.         nm_opt=''
  2850.     fi;;
  2851. esac
  2852.  
  2853. case "$runnm" in
  2854. true)
  2855. : get list of predefined functions in a handy place
  2856. echo " "
  2857. case "$libc" in
  2858. '') libc=unknown
  2859.     case "$libs" in
  2860.     *-lc_s*) libc=`./loc libc_s.a $libc $libpth`
  2861.     esac
  2862.     ;;
  2863. esac
  2864. libnames='';
  2865. case "$libs" in
  2866. '') ;;
  2867. *)  for thislib in $libs; do
  2868.     case "$thislib" in
  2869.     -lc|-lc_s)
  2870.         : Handle C library specially below.
  2871.         ;;
  2872.     -l*)
  2873.         thislib=`echo X$thislib | $sed -e 's/^X//' -e 's/^-l//'`
  2874.         if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
  2875.             :
  2876.         elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
  2877.             :
  2878.         elif try=`./loc lib$thislib.a X $libpth`; $test -f "$try"; then
  2879.             :
  2880.         elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
  2881.             :
  2882.         elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
  2883.             :
  2884.         elif try=`./loc Slib$thislib.a X $xlibpth`; $test -f "$try"; then
  2885.             :
  2886.         else
  2887.             try=''
  2888.         fi
  2889.         libnames="$libnames $try"
  2890.         ;;
  2891.     *) libnames="$libnames $thislib" ;;
  2892.     esac
  2893.     done
  2894.     ;;
  2895. esac
  2896. xxx=normal
  2897. case "$libc" in
  2898. unknown)
  2899.     set /usr/ccs/lib/libc.$so
  2900.     $test -r $1 || set /usr/lib/libc.$so
  2901.     $test -r $1 || set /usr/shlib/libc.$so
  2902.     $test -r $1 || set /usr/lib/libc.$so.[0-9]*
  2903.     $test -r $1 || set /lib/libc.$so
  2904.     $test -r $1 || set /lib/libsys_s.a
  2905.     eval set \$$#
  2906.     ;;
  2907. *)
  2908.     set blurfl
  2909.     ;;
  2910. esac
  2911. if $test -r "$1"; then
  2912.     echo "Your (shared) C library seems to be in $1."
  2913.     libc="$1"
  2914. elif $test -r /lib/libc && $test -r /lib/clib; then
  2915.     echo "Your C library seems to be in both /lib/clib and /lib/libc."
  2916.     xxx=apollo
  2917.     libc='/lib/clib /lib/libc'
  2918.     if $test -r /lib/syslib; then
  2919.         echo "(Your math library is in /lib/syslib.)"
  2920.         libc="$libc /lib/syslib"
  2921.     fi
  2922. elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
  2923.     echo "Your C library seems to be in $libc, as you said before."
  2924. elif $test -r $incpath/usr/lib/libc.a; then
  2925.     libc=$incpath/usr/lib/libc.a;
  2926.     echo "Your C library seems to be in $libc.  That's fine."
  2927. elif $test -r /lib/libc.a; then
  2928.     libc=/lib/libc.a;
  2929.     echo "Your C library seems to be in $libc.  You're normal."
  2930. else
  2931.     if tans=`./loc libc.a blurfl/dyick $libpth`; $test -r "$tans"; then
  2932.         :
  2933.     elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
  2934.         libnames="$libnames "`./loc clib blurfl/dyick $libpth`
  2935.     elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
  2936.         :
  2937.     elif tans=`./loc Slibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then
  2938.         :
  2939.     elif tans=`./loc Mlibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then
  2940.         :
  2941.     else
  2942.         tans=`./loc Llibc.a blurfl/dyick $xlibpth`
  2943.     fi
  2944.     if $test -r "$tans"; then
  2945.         echo "Your C library seems to be in $tans, of all places."
  2946.         libc=$tans
  2947.     else
  2948.         libc='blurfl'
  2949.     fi
  2950. fi
  2951. if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
  2952.     dflt="$libc"
  2953.     cat <<EOM
  2954.  
  2955. If the guess above is wrong (which it might be if you're using a strange
  2956. compiler, or your machine supports multiple models), you can override it here.
  2957.  
  2958. EOM
  2959. else
  2960.     dflt=''
  2961.     echo $libpth | tr ' ' '\012' | sort | uniq > libpath
  2962.     cat >&4 <<EOM
  2963. I can't seem to find your C library.  I've looked in the following places:
  2964.  
  2965. EOM
  2966.     $sed 's/^/    /' libpath
  2967.     cat <<EOM
  2968.  
  2969. None of these seems to contain your C library. I need to get its name...
  2970.  
  2971. EOM
  2972. fi
  2973. fn=f
  2974. rp='Where is your C library?'
  2975. . ./getfile
  2976. libc="$ans"
  2977.  
  2978. echo " "
  2979. echo $libc $libnames | tr ' ' '\012' | sort | uniq > libnames
  2980. set X `cat libnames`
  2981. shift
  2982. xxx=files
  2983. case $# in 1) xxx=file; esac
  2984. echo "Extracting names from the following $xxx for later perusal:" >&4
  2985. echo " "
  2986. $sed 's/^/    /' libnames >&4
  2987. echo " "
  2988. $echo $n "This may take a while...$c" >&4
  2989. nm $nm_opt $* 2>/dev/null >libc.tmp
  2990. $echo $n ".$c"
  2991. $grep fprintf libc.tmp > libc.ptf
  2992. xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
  2993. xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
  2994. if com="$sed -n -e 's/^.* [ADTSI]  *_[_.]*//p' -e 's/^.* [ADTSI] //p'";\
  2995.     eval $xscan;\
  2996.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  2997.         eval $xrun
  2998. elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
  2999.     eval $xscan;\
  3000.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  3001.         eval $xrun
  3002. elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
  3003.     eval $xscan;\
  3004.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  3005.         eval $xrun
  3006. elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
  3007.     eval $xscan;\
  3008.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  3009.         eval $xrun
  3010. elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
  3011.     eval $xscan;\
  3012.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  3013.         eval $xrun
  3014. elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
  3015.     eval $xscan;\
  3016.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  3017.         eval $xrun
  3018. elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
  3019.                 -e '/ file/d' -e 's/^\([^     ]*\).*/\1/p'";\
  3020.     eval $xscan;\
  3021.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  3022.         eval $xrun
  3023. elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
  3024.     eval $xscan;\
  3025.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  3026.         eval $xrun
  3027. elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
  3028.     eval $xscan;\
  3029.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  3030.         eval $xrun
  3031. elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
  3032.     eval $xscan;\
  3033.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  3034.         eval $xrun
  3035. else
  3036.     nm -p $* 2>/dev/null >libc.tmp
  3037.     com="$sed -n -e 's/^.* [ADTS]  *_[_.]*//p' -e 's/^.* [ADTS] //p'";\
  3038.     eval "<libc.tmp $com >libc.list"
  3039.     if $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  3040.         nm_opt='-p'
  3041.         echo "done" >&4
  3042.     else
  3043.         echo " "
  3044.         echo "nm didn't seem to work right. Trying ar instead..." >&4
  3045.         com=''
  3046.         if ar t $libc > libc.tmp; then
  3047.             for thisname in $libnames; do
  3048.                 ar t $thisname >>libc.tmp
  3049.             done
  3050.             $sed -e 's/\.o$//' < libc.tmp > libc.list
  3051.             echo "Ok." >&4
  3052.         else
  3053.             echo "ar didn't seem to work right." >&4
  3054.             echo "Maybe this is a Cray...trying bld instead..." >&4
  3055.             if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
  3056.                 for thisname in $libnames; do
  3057.                     bld t $libnames | \
  3058.                     $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
  3059.                     ar t $thisname >>libc.tmp
  3060.                 done
  3061.                 echo "Ok." >&4
  3062.             else
  3063.                 echo "That didn't work either.  Giving up." >&4
  3064.                 exit 1
  3065.             fi
  3066.         fi
  3067.     fi
  3068. fi
  3069. nm_extract="$com"
  3070. if $test -f /lib/syscalls.exp; then
  3071.     echo " "
  3072.     echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
  3073.     $sed -n 's/^\([^     ]*\)[     ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
  3074. fi
  3075. ;;
  3076. esac
  3077. $rm -f libnames libpath
  3078.  
  3079. : is a C symbol defined?
  3080. csym='tlook=$1;
  3081. case "$3" in
  3082. -v) tf=libc.tmp; tc=""; tdc="";;
  3083. -a) tf=libc.tmp; tc="[0]"; tdc=[];;
  3084. *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
  3085. esac;
  3086. tx=yes;
  3087. case "$reuseval-$4" in
  3088. true-) ;;
  3089. true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
  3090. esac;
  3091. case "$tx" in
  3092. yes)
  3093.     case "$runnm" in
  3094.     true)
  3095.         if $contains $tlook $tf >/dev/null 2>&1;
  3096.         then tval=true;
  3097.         else tval=false;
  3098.         fi;;
  3099.     *)
  3100.         echo "main() { extern int $1$tdc; printf(\"%d\", $1$tc); }" > t.c;
  3101.         if $cc $ccflags -o t t.c $ldflags $libs >/dev/null 2>&1;
  3102.         then tval=true;
  3103.         else tval=false;
  3104.         fi;
  3105.         $rm -f t t.c;;
  3106.     esac;;
  3107. *)
  3108.     case "$tval" in
  3109.     $define) tval=true;;
  3110.     *) tval=false;;
  3111.     esac;;
  3112. esac;
  3113. eval "$2=$tval"'
  3114.  
  3115. : set up the script used to warn in case of inconsistency
  3116. cat <<'EOSC' >whoa
  3117. dflt=y
  3118. echo " "
  3119. echo "*** WHOA THERE!!! ***" >&4
  3120. echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
  3121. rp="    Keep the $hint value?"
  3122. . ./myread
  3123. case "$ans" in
  3124. y) td=$was; tu=$was;;
  3125. esac
  3126. EOSC
  3127.  
  3128. : define an is-in-libc? function
  3129. inlibc='echo " "; td=$define; tu=$undef;
  3130. sym=$1; var=$2; eval "was=\$$2";
  3131. tx=yes;
  3132. case "$reuseval$was" in
  3133. true) ;;
  3134. true*) tx=no;;
  3135. esac;
  3136. case "$tx" in
  3137. yes)
  3138.     set $sym tres -f;
  3139.     eval $csym;
  3140.     case "$tres" in
  3141.     true)
  3142.         echo "$sym() found." >&4;
  3143.         case "$was" in $undef) . whoa; esac; eval "$var=\$td";;
  3144.     *)
  3145.         echo "$sym() NOT found." >&4;
  3146.         case "$was" in $define) . whoa; esac; eval "$var=\$tu";;
  3147.     esac;;
  3148. *)
  3149.     case "$was" in
  3150.     $define) echo "$sym() found." >&4;;
  3151.     *) echo "$sym() NOT found." >&4;;
  3152.     esac;;
  3153. esac'
  3154.  
  3155. : see if gconvert exists
  3156. set gconvert d_gconvert
  3157. eval $inlibc
  3158.  
  3159. case "$d_gconvert" in
  3160. $define)
  3161.     d_Gconvert="gconvert((x),(n),(t),(b))"
  3162.     ;;
  3163. *)
  3164.     : Maybe we can emulate it with gcvt.
  3165.     set gcvt d_gcvt
  3166.     eval $inlibc
  3167.  
  3168.     case "$d_gcvt" in
  3169.     $define) 
  3170.         : Test whether gcvt drops a trailing decimal point
  3171.         cat >try.c <<'EOP'
  3172. main() { 
  3173. char buf[64]; 
  3174. gcvt(1.0, 8, buf); 
  3175. if (buf[0] != '1' || buf[1] != '\0')
  3176.     return 1;
  3177. gcvt(0.0, 8, buf); 
  3178. if (buf[0] != '0' || buf[1] != '\0')
  3179.     return 1;
  3180. gcvt(-1.0, 8, buf); 
  3181. if (buf[0] != '-' || buf[1] != '1' || buf[2] != '\0')
  3182.     return 1;
  3183. return 0;
  3184. }
  3185. EOP
  3186.         if $cc $ccflags $ldflags -o try try.c $libs > /dev/null 2>&1; then
  3187.             if ./try; then
  3188.                 echo "Good, your gcvt() drops a trailing decimal point."
  3189.                 d_Gconvert="gcvt((x),(n),(b))"
  3190.             else
  3191.                 echo "But your gcvt() keeps a trailing decimal point".
  3192.                 d_Gconvert=''
  3193.             fi
  3194.         else
  3195.             echo "Hmm.  I can't compile the gcvt test program."
  3196.             d_Gconvert=''
  3197.         fi
  3198.         $rm -f try.c try
  3199.         ;;
  3200.     esac
  3201.     case "$d_Gconvert" in
  3202.     '')
  3203.         echo "I'll use sprintf instead." >&4
  3204.         d_Gconvert='sprintf((b),"%.*g",(n),(x))'
  3205.         ;;
  3206.     esac
  3207. esac
  3208.  
  3209. : Initialize h_fcntl
  3210. h_fcntl=false
  3211.  
  3212. : Initialize h_sysfile
  3213. h_sysfile=false
  3214.  
  3215. : determine filename position in cpp output
  3216. echo " "
  3217. echo "Computing filename position in cpp output for #include directives..." >&4
  3218. echo '#include <stdio.h>' > foo.c
  3219. $cat >fieldn <<EOF
  3220. $startsh
  3221. $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
  3222. $grep '^[     ]*#.*stdio\.h' | \
  3223. while read cline; do
  3224.     pos=1
  3225.     set \$cline
  3226.     while $test \$# -gt 0; do
  3227.         if $test -r \`echo \$1 | $tr -d '"'\`; then
  3228.             echo "\$pos"
  3229.             exit 0
  3230.         fi
  3231.         shift
  3232.         pos=\`expr \$pos + 1\`
  3233.     done
  3234. done
  3235. EOF
  3236. chmod +x fieldn
  3237. fieldn=`./fieldn`
  3238. $rm -f foo.c fieldn
  3239. case $fieldn in
  3240. '') pos='???';;
  3241. 1) pos=first;;
  3242. 2) pos=second;;
  3243. 3) pos=third;;
  3244. *) pos="${fieldn}th";;
  3245. esac
  3246. echo "Your cpp writes the filename in the $pos field of the line."
  3247.  
  3248. : locate header file
  3249. $cat >findhdr <<EOF
  3250. $startsh
  3251. wanted=\$1
  3252. name=''
  3253. if test -f $usrinc/\$wanted; then
  3254.     echo "$usrinc/\$wanted"
  3255.     exit 0
  3256. fi
  3257. awkprg='{ print \$$fieldn }'
  3258. echo "#include <\$wanted>" > foo\$\$.c
  3259. $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
  3260. $grep "^[     ]*#.*\$wanted" | \
  3261. while read cline; do
  3262.     name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
  3263.     case "\$name" in
  3264.     */\$wanted) echo "\$name"; exit 0;;
  3265.     *) name='';;
  3266.     esac;
  3267. done;
  3268. $rm -f foo\$\$.c;
  3269. case "\$name" in
  3270. '') exit 1;;
  3271. esac
  3272. EOF
  3273. chmod +x findhdr
  3274.  
  3275. : access call always available on UNIX
  3276. set access d_access
  3277. eval $inlibc
  3278.  
  3279. : locate the flags for 'access()'
  3280. case "$d_access" in
  3281. "$define")
  3282.     echo " "
  3283.     $cat >access.c <<'EOCP'
  3284. #include <sys/types.h>
  3285. #ifdef I_FCNTL
  3286. #include <fcntl.h>
  3287. #endif
  3288. #ifdef I_SYS_FILE
  3289. #include <sys/file.h>
  3290. #endif
  3291. #ifdef I_UNISTD
  3292. #include <unistd.h>
  3293. #endif
  3294. main() {
  3295.     exit(R_OK);
  3296. }
  3297. EOCP
  3298.     : check sys/file.h first, no particular reason here
  3299.     if $test `./findhdr sys/file.h` && \
  3300.         $cc $cppflags -DI_SYS_FILE access.c -o access >/dev/null 2>&1 ; then
  3301.         h_sysfile=true;
  3302.         echo "<sys/file.h> defines the *_OK access constants." >&4
  3303.     elif $test `./findhdr fcntl.h` && \
  3304.         $cc $cppflags -DI_FCNTL access.c -o access >/dev/null 2>&1 ; then
  3305.         h_fcntl=true;
  3306.         echo "<fcntl.h> defines the *_OK access constants." >&4
  3307.     elif $test `./findhdr unistd.h` && \
  3308.         $cc $cppflags -DI_UNISTD access.c -o access >/dev/null 2>&1 ; then
  3309.         echo "<unistd.h> defines the *_OK access constants." >&4
  3310.     else
  3311.         echo "I can't find the four *_OK access constants--I'll use mine." >&4
  3312.     fi
  3313.     ;;
  3314. esac
  3315. $rm -f access*
  3316.  
  3317. : see if alarm exists
  3318. set alarm d_alarm
  3319. eval $inlibc
  3320.  
  3321. : is AFS running?
  3322. echo " "
  3323. if test -d /afs; then
  3324.     echo "AFS may be running... I'll be extra cautious then..." >&4
  3325.     afs=true
  3326. else
  3327.     echo "AFS does not seem to be running..." >&4
  3328.     afs=false
  3329. fi
  3330.  
  3331. : determine root of directory hierarchy where package will be installed.
  3332. case "$prefix" in
  3333. '')
  3334.     dflt=`./loc . /usr/local /usr/local /local /opt /usr`
  3335.     ;;
  3336. *)
  3337.     dflt="$prefix"
  3338.     ;;
  3339. esac
  3340. $cat <<EOM
  3341.  
  3342. By default, $package will be installed in $dflt/bin, manual
  3343. pages under $dflt/man, etc..., i.e. with $dflt as prefix for
  3344. all installation directories. Typically set to /usr/local, but you
  3345. may choose /usr if you wish to install $package among your system
  3346. binaries. If you wish to have binaries under /bin but manual pages
  3347. under /usr/local/man, that's ok: you will be prompted separately
  3348. for each of the installation directories, the prefix being only used
  3349. to set defaults.
  3350.  
  3351. EOM
  3352. fn=d~
  3353. rp='Installation prefix to use?'
  3354. . ./getfile
  3355. prefix="$ans"
  3356.  
  3357. : determine where private executables go
  3358. case "$privlib" in
  3359. '')
  3360.     dflt=$prefix/lib/$package
  3361.     ;;
  3362. *)  dflt="$privlib"
  3363.     ;;
  3364. esac
  3365. $cat <<EOM
  3366.  
  3367. There are some auxiliary files for $package that need to be put into a
  3368. private library directory that is accessible by everyone.
  3369.  
  3370. EOM
  3371. fn=d~+
  3372. rp='Pathname where private library files will reside?'
  3373. . ./getfile
  3374. privlib="$ans"
  3375. privlibexp="$ansexp"
  3376. if $afs; then
  3377.     $cat <<EOM
  3378.  
  3379. Since you are running AFS, I need to distinguish the directory in which
  3380. private files reside from the directory in which they are installed (and from
  3381. which they are presumably copied to the former directory by occult means).
  3382.  
  3383. EOM
  3384.     case "$installprivlib" in
  3385.     '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
  3386.     *) dflt="$installprivlib";;
  3387.     esac
  3388.     fn=de~
  3389.     rp='Where will private files be installed?'
  3390.     . ./getfile
  3391.     installprivlib="$ans"
  3392. else
  3393.     installprivlib="$privlibexp"
  3394. fi
  3395.  
  3396. : determine where public architecture dependent libraries go
  3397. case "$archname" in
  3398. '')    tpath=`echo $PATH | sed -e 's/:/ /g'`
  3399.     xxx=`./loc arch blurfl $tpath`
  3400.     if test -f "$xxx"; then
  3401.         tarchname=`arch`
  3402.         archname="${tarchname}-${osname}"
  3403.     else
  3404.         archname="$osname"
  3405.     fi
  3406.     ;;
  3407. esac
  3408. case "$privlib" in
  3409. '') dflt=`./loc . "." $prefix/lib /usr/local/lib /usr/lib /lib`;;
  3410. *)  dflt="$privlib/$archname";;
  3411. esac
  3412. fn=d~
  3413. cat <<EOM
  3414.  
  3415. $package contains architecture-dependent library files.  If you are
  3416. sharing libraries in a heterogeneous environment, you might store
  3417. these files in a separate location.  Otherwise, you can just include
  3418. them with the rest of the public library files.
  3419.  
  3420. EOM
  3421. rp='Where do you want to put the public architecture-dependent libraries?'
  3422. . ./getfile
  3423. archlib="$ans"
  3424. archlibexp="$ansexp"
  3425.  
  3426. if $afs; then
  3427.     $cat <<EOM
  3428.  
  3429. Since you are running AFS, I need to distinguish the directory in which
  3430. private files reside from the directory in which they are installed (and from
  3431. which they are presumably copied to the former directory by occult means).
  3432.  
  3433. EOM
  3434.     case "$installarchlib" in
  3435.     '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;;
  3436.     *) dflt="$installarchlib";;
  3437.     esac
  3438.     fn=de~
  3439.     rp='Where will architecture-dependent library files be installed?'
  3440.     . ./getfile
  3441.     installarchlib="$ans"
  3442. else
  3443.     installarchlib="$archlibexp"
  3444. fi
  3445. if $test X"$archlib" = X"$privlib"; then
  3446.     d_archlib="$undef"
  3447. else
  3448.     d_archlib="$define"
  3449. fi
  3450.  
  3451.  
  3452. : function used to set $1 to $val
  3453. setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
  3454. case "$val$was" in
  3455. $define$undef) . whoa; eval "$var=\$td";;
  3456. $undef$define) . whoa; eval "$var=\$tu";;
  3457. *) eval "$var=$val";;
  3458. esac'
  3459.  
  3460. : Look for GNUC style attribute checking
  3461. echo " "
  3462. echo "Checking whether your compiler can handle __attribute__ ..." >&4
  3463. $cat >attrib.c <<'EOCP'
  3464. void    croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
  3465. EOCP
  3466. if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
  3467.     if $contains 'warning' attrib.out >/dev/null 2>&1; then
  3468.         echo "Your C compiler doesn't fully support __attribute__. ."
  3469.         val="$undef"
  3470.     else
  3471.         echo "Your C compiler supports __attribute__. ."
  3472.         val="$define"
  3473.     fi
  3474. else
  3475.     echo "Your C compiler doesn't seem to understand __attribute__. ."
  3476.     val="$undef"
  3477. fi
  3478. set d_attrib
  3479. eval $setvar
  3480. $rm -f attrib*
  3481.  
  3482. : see if bcmp exists
  3483. set bcmp d_bcmp
  3484. eval $inlibc
  3485.  
  3486. : see if bcopy exists
  3487. set bcopy d_bcopy
  3488. eval $inlibc
  3489.  
  3490. : see if setpgrp exists
  3491. set setpgrp d_setpgrp
  3492. eval $inlibc
  3493.  
  3494. : see which flavor of setpgrp is in use
  3495. case "$d_setpgrp" in
  3496. "$define")
  3497.     echo " "
  3498.     $cat >set.c <<EOP
  3499. main()
  3500. {
  3501.     if (getuid() == 0) {
  3502.         printf("(I see you are running Configure as super-user...)\n");
  3503.         setuid(1);
  3504.     }
  3505.     if (-1 == setpgrp(1, 1))
  3506.         exit(1);
  3507.     exit(0);
  3508. }
  3509. EOP
  3510.     if $cc $ccflags -o set $ldflags set.c $libs >/dev/null 2>&1; then
  3511.         ./set 2>/dev/null
  3512.         case $? in
  3513.         0) echo "You have to use setpgrp() instead of setpgrp(pid, pgrp)." >&4
  3514.             val="$undef";;
  3515.         *) echo "You have to use setpgrp(pid, pgrp) instead of setpgrp()." >&4
  3516.             val="$define";;
  3517.         esac
  3518.     else
  3519.         if usg; then
  3520.             xxx="USG one, i.e. you use setpgrp()."
  3521.             val="$undef"
  3522.         else
  3523.             xxx="BSD one, i.e. you use setpgrp(pid, pgrp)."
  3524.             val="$define"
  3525.         fi
  3526.         echo "Assuming your setpgrp is a $xxx" >&4
  3527.     fi
  3528.     ;;
  3529. *) val="$undef";;
  3530. esac
  3531. set d_bsdpgrp
  3532. eval $setvar
  3533. $rm -f set set.c
  3534.  
  3535. : see if bzero exists
  3536. set bzero d_bzero
  3537. eval $inlibc
  3538.  
  3539. : check for length of integer
  3540. echo " "
  3541. case "$intsize" in
  3542. '')
  3543.     echo "Checking to see how big your integers are..." >&4
  3544.     $cat >try.c <<'EOCP'
  3545. #include <stdio.h>
  3546. main()
  3547. {
  3548.     printf("%d\n", sizeof(int));
  3549. }
  3550. EOCP
  3551.     if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
  3552.         dflt=`./try`
  3553.     else
  3554.         dflt='4'
  3555.         echo "(I can't seem to compile the test program.  Guessing...)"
  3556.     fi
  3557.     ;;
  3558. *)
  3559.     dflt="$intsize"
  3560.     ;;
  3561. esac
  3562. rp="What is the size of an integer (in bytes)?"
  3563. . ./myread
  3564. intsize="$ans"
  3565. $rm -f try.c try
  3566.  
  3567. : check for ability to cast large floats to 32-bit ints.
  3568. echo " "
  3569. echo 'Checking whether your C compiler can cast large floats to int32.' >&4
  3570. if $test "$intsize" -eq 4; then
  3571.     xxx=int
  3572. else
  3573.     xxx=long
  3574. fi
  3575. $cat >try.c <<EOCP
  3576. #include <sys/types.h>
  3577. #include <signal.h>
  3578. blech() { exit(3); }
  3579. main()
  3580. {
  3581.     $xxx i32;
  3582.     double f;
  3583.     int result = 0;
  3584.     signal(SIGFPE, blech);
  3585.  
  3586.     f = (double) 0x7fffffff;
  3587.     f = 10 * f;
  3588.     i32  = ($xxx) f;
  3589.  
  3590.     if (i32 != ($xxx) f)
  3591.         result |= 1;
  3592.     exit(result);
  3593. }
  3594. EOCP
  3595. if $cc -o try $ccflags try.c >/dev/null 2>&1; then
  3596.     ./try
  3597.     yyy=$?
  3598. else
  3599.     echo "(I can't seem to compile the test program--assuming it can't)"
  3600.     yyy=1
  3601. fi
  3602. case "$yyy" in
  3603. 0)    val="$define"
  3604.     echo "Yup, it can."
  3605.     ;;
  3606. *)    val="$undef"
  3607.     echo "Nope, it can't."
  3608.     ;;
  3609. esac
  3610. set d_casti32
  3611. eval $setvar
  3612. $rm -f try try.*
  3613.  
  3614. : check for ability to cast negative floats to unsigned
  3615. echo " "
  3616. echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
  3617. $cat >try.c <<'EOCP'
  3618. #include <signal.h>
  3619. blech() { exit(3); }
  3620. main()
  3621. {
  3622.     double f = -123;
  3623.     unsigned long along;
  3624.     unsigned int aint;
  3625.     unsigned short ashort;
  3626.     int result = 0;
  3627.  
  3628.     signal(SIGFPE, blech);
  3629.     along = (unsigned long)f;
  3630.     aint = (unsigned int)f;
  3631.     ashort = (unsigned short)f;
  3632.     if (along != (unsigned long)-123)
  3633.         result |= 1;
  3634.     if (aint != (unsigned int)-123)
  3635.         result |= 1;
  3636.     if (ashort != (unsigned short)-123)
  3637.         result |= 1;
  3638.     f = (double)0x40000000;
  3639.     f = f + f;
  3640.     along = 0;
  3641.     along = (unsigned long)f;
  3642.     if (along != 0x80000000)
  3643.         result |= 2;
  3644.     f -= 1.;
  3645.     along = 0;
  3646.     along = (unsigned long)f;
  3647.     if (along != 0x7fffffff)
  3648.         result |= 1;
  3649.     f += 2.;
  3650.     along = 0;
  3651.     along = (unsigned long)f;
  3652.     if (along != 0x80000001)
  3653.         result |= 2;
  3654.     exit(result);
  3655.  
  3656. }
  3657. EOCP
  3658. if $cc -o try $ccflags try.c >/dev/null 2>&1; then
  3659.     ./try
  3660.     castflags=$?
  3661. else
  3662.     castflags=3
  3663. fi
  3664. case "$castflags" in
  3665. 0)    val="$define"
  3666.     echo "Yup, it can."
  3667.     ;;
  3668. *)    val="$undef"
  3669.     echo "Nope, it can't."
  3670.     ;;
  3671. esac
  3672. set d_castneg
  3673. eval $setvar
  3674. $rm -f try.*
  3675.  
  3676. : see if sprintf is declared as int or pointer to char
  3677. echo " "
  3678. $cat >ucbsprf.c <<'EOF'
  3679. main()
  3680. {
  3681.     int sprintf();
  3682.     char buf[10];
  3683.     exit((unsigned long)sprintf(buf,"%s","foo") > 10L);
  3684. }
  3685. EOF
  3686. if $cc ucbsprf.c -o ucbsprf >/dev/null 2>&1 && ./ucbsprf; then
  3687.     echo "Your sprintf() returns (int)." >&4
  3688.     val="$undef"
  3689. else
  3690.     echo "Your sprintf() returns (char*)." >&4
  3691.     val="$define"
  3692. fi
  3693. set d_charsprf
  3694. eval $setvar
  3695. $rm -f ucbsprf*
  3696.  
  3697. : see if vprintf exists
  3698. echo " "
  3699. if set vprintf val -f d_vprintf; eval $csym; $val; then
  3700.     echo 'vprintf() found.' >&4
  3701.     val="$define"
  3702.     $cat >vprintf.c <<'EOF'
  3703. #include <varargs.h>
  3704.  
  3705. main() { xxx("foo"); }
  3706.  
  3707. xxx(va_alist)
  3708. va_dcl
  3709. {
  3710.     va_list args;
  3711.     char buf[10];
  3712.  
  3713.     va_start(args);
  3714.     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
  3715. }
  3716. EOF
  3717.     if $cc $ccflags vprintf.c -o vprintf >/dev/null 2>&1 && ./vprintf; then
  3718.         echo "Your vsprintf() returns (int)." >&4
  3719.         val2="$undef"
  3720.     else
  3721.         echo "Your vsprintf() returns (char*)." >&4
  3722.         val2="$define"
  3723.     fi
  3724. else
  3725.     echo 'vprintf() NOT found.' >&4
  3726.         val="$undef"
  3727.         val2="$undef"
  3728. fi
  3729. set d_vprintf
  3730. eval $setvar
  3731. val=$val2
  3732. set d_charvspr
  3733. eval $setvar
  3734.  
  3735. : see if chown exists
  3736. set chown d_chown
  3737. eval $inlibc
  3738.  
  3739. : see if chroot exists
  3740. set chroot d_chroot
  3741. eval $inlibc
  3742.  
  3743. : see if chsize exists
  3744. set chsize d_chsize
  3745. eval $inlibc
  3746.  
  3747. : check for const keyword
  3748. echo " "
  3749. echo 'Checking to see if your C compiler knows about "const"...' >&4
  3750. $cat >const.c <<'EOCP'
  3751. typedef struct spug { int drokk; } spug;
  3752. main()
  3753. {
  3754.     const char *foo;
  3755.     const spug y;
  3756. }
  3757. EOCP
  3758. if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
  3759.     val="$define"
  3760.     echo "Yup, it does."
  3761. else
  3762.     val="$undef"
  3763.     echo "Nope, it doesn't."
  3764. fi
  3765. set d_const
  3766. eval $setvar
  3767.  
  3768. : see if crypt exists
  3769. echo " "
  3770. if set crypt val -f d_crypt; eval $csym; $val; then
  3771.     echo 'crypt() found.' >&4
  3772.     val="$define"
  3773.     cryptlib=''
  3774. else
  3775.     cryptlib=`./loc Slibcrypt.a "" $xlibpth`
  3776.     if $test -z "$cryptlib"; then
  3777.         cryptlib=`./loc Mlibcrypt.a "" $xlibpth`
  3778.     else
  3779.         cryptlib=-lcrypt
  3780.     fi
  3781.     if $test -z "$cryptlib"; then
  3782.         cryptlib=`./loc Llibcrypt.a "" $xlibpth`
  3783.     else
  3784.         cryptlib=-lcrypt
  3785.     fi
  3786.     if $test -z "$cryptlib"; then
  3787.         cryptlib=`./loc libcrypt.a "" $libpth`
  3788.     else
  3789.         cryptlib=-lcrypt
  3790.     fi
  3791.     if $test -z "$cryptlib"; then
  3792.         echo 'crypt() NOT found.' >&4
  3793.         val="$undef"
  3794.     else
  3795.         val="$define"
  3796.     fi
  3797. fi
  3798. set d_crypt
  3799. eval $setvar
  3800.  
  3801. : get csh whereabouts
  3802. case "$csh" in
  3803. 'csh') val="$undef" ;;
  3804. *) val="$define" ;;
  3805. esac
  3806. set d_csh
  3807. eval $setvar
  3808.  
  3809. : see if cuserid exists
  3810. set cuserid d_cuserid
  3811. eval $inlibc
  3812.  
  3813. : define an alternate in-header-list? function
  3814. inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
  3815. cont=true; xxf="echo \"<\$1> found.\" >&4";
  3816. case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
  3817. *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
  3818. esac;
  3819. case $# in 4) instead=instead;; *) instead="at last";; esac;
  3820. while $test "$cont"; do
  3821.     xxx=`./findhdr $1`
  3822.     var=$2; eval "was=\$$2";
  3823.     if $test "$xxx" && $test -r "$xxx";
  3824.     then eval $xxf;
  3825.         eval "case \"\$$var\" in $undef) . whoa; esac"; eval "$var=\$td";
  3826.         cont="";
  3827.     else eval $xxnf;
  3828.         eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu"; fi;
  3829.     set $yyy; shift; shift; yyy=$@;
  3830.     case $# in 0) cont="";;
  3831.     2) xxf="echo \"but I found <\$1> $instead.\" >&4";
  3832.         xxnf="echo \"and I did not find <\$1> either.\" >&4";;
  3833.     *) xxf="echo \"but I found <\$1\> instead.\" >&4";
  3834.         xxnf="echo \"there is no <\$1>, ...\" >&4";;
  3835.     esac;
  3836. done;
  3837. while $test "$yyy";
  3838. do set $yyy; var=$2; eval "was=\$$2";
  3839.     eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu";
  3840.     set $yyy; shift; shift; yyy=$@;
  3841. done'
  3842.  
  3843. : see if this is a limits.h system
  3844. set limits.h i_limits
  3845. eval $inhdr
  3846.  
  3847. : see if this is a float.h system
  3848. set float.h i_float
  3849. eval $inhdr
  3850.  
  3851. : See if number of significant digits in a double precision number is known
  3852. echo " "
  3853. $cat >dbl_dig.c <<EOM
  3854. #$i_limits I_LIMITS
  3855. #$i_float I_FLOAT
  3856. #ifdef I_LIMITS
  3857. #include <limits.h>
  3858. #endif
  3859. #ifdef I_FLOAT
  3860. #include <float.h>
  3861. #endif
  3862. #ifdef DBL_DIG
  3863. printf("Contains DBL_DIG");
  3864. #endif
  3865. EOM
  3866. $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
  3867. if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
  3868.     echo "DBL_DIG found." >&4
  3869.     val="$define"
  3870. else
  3871.     echo "DBL_DIG NOT found." >&4
  3872.     val="$undef"
  3873. fi
  3874. $rm -f dbl_dig.?
  3875. set d_dbl_dig
  3876. eval $setvar
  3877.  
  3878. : see if difftime exists
  3879. set difftime d_difftime
  3880. eval $inlibc
  3881.  
  3882. : see if this is a dirent system
  3883. echo " "
  3884. if xinc=`./findhdr dirent.h`; $test "$xinc"; then
  3885.     val="$define"
  3886.     echo "<dirent.h> found." >&4
  3887. else
  3888.     val="$undef"
  3889.     if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
  3890.         echo "<sys/dir.h> found." >&4
  3891.         echo " "
  3892.     else
  3893.         xinc=`./findhdr sys/ndir.h`
  3894.     fi
  3895.     echo "<dirent.h> NOT found." >&4
  3896. fi
  3897. set i_dirent
  3898. eval $setvar
  3899.  
  3900. : Look for type of directory structure.
  3901. echo " "
  3902. $cppstdin $cppflags $cppminus < "$xinc" > try.c
  3903.  
  3904. case "$direntrytype" in
  3905. ''|' ')
  3906.     case "$i_dirent" in
  3907.     $define) guess1='struct dirent' ;;
  3908.     *) guess1='struct direct'  ;;
  3909.     esac
  3910.     ;;
  3911. *)    guess1="$direntrytype"
  3912.     ;;
  3913. esac
  3914.  
  3915. case "$guess1" in
  3916. 'struct dirent') guess2='struct direct' ;;
  3917. *) guess2='struct dirent' ;;
  3918. esac
  3919.         
  3920. if $contains "$guess1" try.c >/dev/null 2>&1; then
  3921.     direntrytype="$guess1"
  3922.     echo "Your directory entries are $direntrytype." >&4
  3923. elif $contains "$guess2" try.c >/dev/null 2>&1; then
  3924.     direntrytype="$guess2"
  3925.     echo "Your directory entries seem to be $direntrytype." >&4
  3926. else
  3927.     echo "I don't recognize your system's directory entries." >&4
  3928.     rp="What type is used for directory entries on this system?"
  3929.     dflt="$guess1"
  3930.     . ./myread
  3931.     direntrytype="$ans"
  3932. fi
  3933. $rm -f try.c
  3934.  
  3935.  
  3936. : see if the directory entry stores field length
  3937. echo " "
  3938. if $contains 'd_namlen' $xinc >/dev/null 2>&1; then
  3939.     echo "Good, your directory entry keeps length information in d_namlen." >&4
  3940.     val="$define"
  3941. else
  3942.     echo "Your directory entry does not know about the d_namlen field." >&4
  3943.     val="$undef"
  3944. fi
  3945. set d_dirnamlen
  3946. eval $setvar
  3947.  
  3948. : see if dlerror exists
  3949. set dlerror d_dlerror
  3950. eval $inlibc
  3951.  
  3952. : see if dld is available
  3953. set dld.h i_dld
  3954. eval $inhdr
  3955.  
  3956. : see if dlopen exists
  3957. set dlopen d_dlopen
  3958. eval $inlibc
  3959.  
  3960. : determine which dynamic loading, if any, to compile in
  3961. echo " "
  3962. dldir="ext/DynaLoader"
  3963. case "$usedl" in
  3964. $define|y|true)
  3965.     dflt='y'
  3966.     usedl="$define"
  3967.     ;;
  3968. $undef|n|false)
  3969.     dflt='n'
  3970.     usedl="$undef"
  3971.     ;;
  3972. *) 
  3973.     dflt='n'
  3974.     case "$d_dlopen" in
  3975.     define) dflt='y' ;;
  3976.     esac
  3977.     case "$i_dld" in
  3978.     define) dflt='y' ;;
  3979.     esac
  3980.     : Does a dl_xxx.xs file exist for this operating system
  3981.     $test -f ../$dldir/dl_${osname}.xs && dflt='y'
  3982.     ;;
  3983. esac
  3984. rp="Do you wish to use dynamic loading?"
  3985. . ./myread
  3986. usedl="$ans"
  3987. case "$ans" in
  3988. y*) usedl="$define"
  3989.     case "$dlsrc" in
  3990.     '')
  3991.         if $test -f ../$dldir/dl_${osname}.xs ; then
  3992.             dflt="$dldir/dl_${osname}.xs"
  3993.         elif $test "$d_dlopen" = "$define" ; then
  3994.             dflt="$dldir/dl_dlopen.xs"
  3995.         elif $test "$i_dld" = "$define" ; then
  3996.             dflt="$dldir/dl_dld.xs"
  3997.         else
  3998.             dflt=''
  3999.         fi
  4000.         ;;
  4001.     *)    dflt="$dldir/$dlsrc"
  4002.         ;;
  4003.     esac
  4004.     echo "The following dynamic loading files are available:"
  4005.     : Can not go over to $dldir because getfile has path hard-coded in.
  4006.     cd ..; ls -C $dldir/dl*.xs; cd UU
  4007.     rp="Source file to use for dynamic loading"
  4008.     fn="fne~"
  4009.     . ./getfile
  4010.     usedl="$define"
  4011.     : emulate basename
  4012.     dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
  4013.     $cat << EOM
  4014.  
  4015. Some systems may require passing special flags to $cc -c to
  4016. compile modules that will be used to create a shared library.
  4017. To use no flags, say "none".
  4018.  
  4019. EOM
  4020.     case "$cccdlflags" in
  4021.     ''|' ') case "$osname" in
  4022.             hpux)  dflt='+z' ;;
  4023.             next)  dflt='none' ;;
  4024.             sunos) 
  4025.                 case "$cc" in
  4026.                 *gcc*)    dflt='-fpic' ;;
  4027.                 *)        dflt='-pic' ;;
  4028.                 esac
  4029.                 ;;
  4030.             solaris) 
  4031.                 case "$cc" in
  4032.                 *gcc*)    dflt='-fpic' ;;
  4033.                 *)        dflt='-K pic' ;;
  4034.                 esac
  4035.                 ;;
  4036.             *)     dflt='none' ;;
  4037.             esac
  4038.             ;;
  4039.     *) dflt="$cccdlflags" ;;
  4040.     esac
  4041.     rp="Any special flags to pass to $cc -c to compile shared library modules?"
  4042.     . ./myread
  4043.     case "$ans" in
  4044.     none) cccdlflags='' ;;
  4045.     *) cccdlflags="$ans" ;;
  4046.     esac
  4047.  
  4048.     cat << 'EOM'
  4049.  
  4050. Some systems may require passing special flags to ld to create a shared
  4051. library.  If your ld flags include -L/local/path options to locate libraries
  4052. outside your loader's normal search path, you may need to specify those
  4053. -L options here as well.
  4054. To use no flags, say "none".
  4055.  
  4056. EOM
  4057.     case "$lddlflags" in
  4058.     ''|' ') case "$osname" in
  4059.             hpux)  dflt='-b' ;;
  4060.             next)  dflt='none' ;;
  4061.             solaris) dflt='-G' ;;
  4062.             sunos) dflt='none' ;;
  4063.             *)     dflt='none' ;;
  4064.             esac
  4065.             ;;
  4066.     *) dflt="$lddlflags" ;;
  4067.     esac
  4068.     rp="Any special flags to pass to ld to create a shared library?"
  4069.     . ./myread
  4070.     case "$ans" in
  4071.     none) lddlflags='' ;;
  4072.     *) lddlflags="$ans" ;;
  4073.     esac
  4074.  
  4075.     cat <<EOM
  4076.  
  4077. Some systems may require passing special flags to $cc to indicate that
  4078. the resulting executable will use dynamic linking.  To use no flags,
  4079. say "none".
  4080.  
  4081. EOM
  4082.     case "$ccdlflags" in
  4083.     ''|' ')
  4084.         case "$osname" in
  4085.         hpux)  dflt='none' ;;
  4086.         next)  dflt='none' ;;
  4087.         sunos) dflt='none' ;;
  4088.         *)     dflt='none' ;;
  4089.         esac
  4090.         ;;
  4091.     *)  dflt="$ccdlflags"
  4092.         ;;
  4093.     esac
  4094.     rp="Any special flags to pass to $cc to use dynamic loading?"
  4095.     . ./myread
  4096.     case "$ans" in
  4097.     none) ccdlflags='' ;;
  4098.     *) ccdlflags="$ans" ;;
  4099.     esac
  4100.     ;;
  4101. *)  usedl="$undef"
  4102.     dlsrc='dl_none.xs'
  4103.     lddlflags=''
  4104.     ccdlflags=''
  4105.     ;;
  4106. esac
  4107.  
  4108. : see if dlfcn is available
  4109. set dlfcn.h i_dlfcn
  4110. eval $inhdr
  4111.  
  4112. case "$usedl" in
  4113. $define|y|true)
  4114.     $cat << EOM
  4115.  
  4116. On a few systems, the dynamically loaded modules that perl generates and uses
  4117. will need a different extension then shared libs. The default will probably
  4118. be appropriate.
  4119.  
  4120. EOM
  4121.     case "$dlext" in
  4122.     '')    dflt="$so" ;;
  4123.     *)    dflt="$dlext" ;;
  4124.     esac
  4125.     rp='What is the extension of dynamically loaded modules'
  4126.     . ./myread
  4127.     dlext="$ans"
  4128.     ;;
  4129. *)
  4130.     dlext="none"
  4131.     ;;
  4132. esac
  4133.  
  4134. : Check if dlsym need a leading underscore
  4135. echo " "
  4136. val="$undef"
  4137.  
  4138. case "$dlsrc" in
  4139. dl_dlopen.xs)
  4140.     echo "Checking whether your dlsym() needs a leading underscore ..." >&4
  4141.     $cat >dyna.c <<'EOM'
  4142. fred () { }
  4143. EOM
  4144.  
  4145. $cat >fred.c<<EOM
  4146.  
  4147. #include <stdio.h>
  4148. #$i_dlfcn I_DLFCN
  4149. #ifdef I_DLFCN
  4150. #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
  4151. #else
  4152. #include <sys/types.h>
  4153. #include <nlist.h>
  4154. #include <link.h>
  4155. #endif
  4156.  
  4157. extern int fred() ;
  4158.  
  4159. main()
  4160. {
  4161.     void * handle ;
  4162.     void * symbol ;
  4163. #ifndef RTLD_LAZY
  4164.     int mode = 1 ;
  4165. #else
  4166.     int mode = RTLD_LAZY ;
  4167. #endif
  4168.     handle = dlopen("./dyna.$dlext", mode) ;
  4169.     if (handle == NULL) {
  4170.         printf ("1\n") ;
  4171.         exit(0);
  4172.     }
  4173.     symbol = dlsym(handle, "fred") ;
  4174.     if (symbol == NULL) {
  4175.         /* try putting a leading underscore */
  4176.         symbol = dlsym(handle, "_fred") ;
  4177.         if (symbol == NULL) {
  4178.             printf ("2\n") ;
  4179.             exit(0);
  4180.         }
  4181.         printf ("3\n") ;
  4182.     }
  4183.     else
  4184.         printf ("4\n") ;
  4185.     exit(0);
  4186. }
  4187. EOM
  4188.     if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
  4189.         ld $lddlflags -o dyna.$dlext dyna.o > /dev/null 2>&1 && 
  4190.         $cc $ccflags $ldflags $cccdlflags $ccdlflags fred.c -o fred $libs > /dev/null 2>&1; then
  4191.         xxx=`./fred`
  4192.         case $xxx in
  4193.         1)    echo "Test program failed using dlopen." >&4
  4194.             echo "Perhaps you should not use dynamic loading." >&4;;
  4195.         2)    echo "Test program failed using dlsym." >&4
  4196.             echo "Perhaps you should not use dynamic loading." >&4;;
  4197.         3)    echo "dlsym needs a leading underscore" >&4
  4198.             val="$define" ;;
  4199.         4)    echo "dlsym doesn't need a leading underscore." >&4;;
  4200.         esac
  4201.     else
  4202.         echo "I can't compile and run the test program." >&4
  4203.     fi
  4204.     ;;
  4205. esac
  4206.         
  4207. $rm -f fred fred.? dyna.$dlext dyna.?
  4208.  
  4209. set d_dlsymun
  4210. eval $setvar
  4211.  
  4212. : see if setuid scripts can be secure
  4213. cat <<EOM
  4214.  
  4215. Some kernels have a bug that prevents setuid #! scripts from being
  4216. secure.  Some sites have disabled setuid #! scripts because of this.
  4217.  
  4218. First let's decide if your kernel supports secure setuid #! scripts.
  4219. (If setuid #! scripts would be secure but have been disabled anyway,
  4220. don't say that they are secure if asked.)
  4221.  
  4222. EOM
  4223.  
  4224. val="$undef"
  4225. if $test -d /dev/fd; then
  4226.     echo "#!$ls" >reflect
  4227.     chmod +x,u+s reflect
  4228.     ./reflect >flect 2>&1
  4229.     if $contains "/dev/fd" flect >/dev/null; then
  4230.         echo "Congratulations, your kernel has secure setuid scripts!" >&4
  4231.         val="$define"
  4232.     else
  4233.         $cat <<EOM
  4234. If you are not sure if they are secure, I can check but I'll need a
  4235. username and password different from the one you are using right now.
  4236. If you don't have such a username or don't want me to test, simply
  4237. enter 'none'.
  4238.  
  4239. EOM
  4240.         rp='Other username to test security of setuid scripts with?'
  4241.         dflt='none'
  4242.         . ./myread
  4243.         case "$ans" in
  4244.         n|none)
  4245.             case "$d_suidsafe" in
  4246.             '')    echo "I'll assume setuid scripts are *not* secure." >&4
  4247.                 dflt=n;;
  4248.             "$undef")
  4249.                 echo "Well, the $hint value is *not* secure." >&4
  4250.                 dflt=n;;
  4251.             *)    echo "Well, the $hint value  *is* secure." >&4
  4252.                 dflt=y;;
  4253.             esac
  4254.             ;;
  4255.         *)    $rm -f reflect flect
  4256.             echo "#!$ls" >reflect
  4257.             chmod +x,u+s reflect
  4258.             echo >flect
  4259.             chmod a+w flect
  4260.             echo '"su" will (probably) prompt you for '"$ans's password."
  4261.             su $ans -c './reflect >flect'
  4262.             if $contains "/dev/fd" flect >/dev/null; then
  4263.                 echo "Okay, it looks like setuid scripts are secure." >&4
  4264.                 dflt=y
  4265.             else
  4266.                 echo "I don't think setuid scripts are secure." >&4
  4267.                 dflt=n
  4268.             fi
  4269.             ;;
  4270.         esac
  4271.         rp='Does your kernel have *secure* setuid scripts?'
  4272.         . ./myread
  4273.         case "$ans" in
  4274.         [yY]*)    val="$define";;
  4275.         *)    val="$undef";;
  4276.         esac
  4277.     fi
  4278. else
  4279.     echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
  4280.     val="$undef"
  4281. fi
  4282. set d_suidsafe
  4283. eval $setvar
  4284.  
  4285. $rm -f reflect flect
  4286.  
  4287. : now see if they want to do setuid emulation
  4288. cat <<EOM
  4289.  
  4290. Some systems have disabled setuid scripts, especially systems where
  4291. setuid scripts cannot be secure.  On systems where setuid scripts have
  4292. been disabled, the setuid/setgid bits on scripts are currently
  4293. useless.  It is possible for $package to detect those bits and emulate
  4294. setuid/setgid in a secure fashion.  This emulation will only work if
  4295. setuid scripts have been disabled in your kernel.
  4296.  
  4297. EOM
  4298. val="$undef"
  4299. case "$d_suidsafe" in
  4300. "$define")
  4301.     val="$undef"
  4302.     echo "No need to emulate SUID scripts since they are secure here." >& 4
  4303.     ;;
  4304. *)
  4305.     case "$d_dosuid" in
  4306.     "$define") dflt=y ;;
  4307.     *) dflt=n ;;
  4308.     esac
  4309.     rp="Do you want to do setuid/setgid emulation?"
  4310.     . ./myread
  4311.     case "$ans" in
  4312.     [yY]*)    val="$define";;
  4313.     *)    val="$undef";;
  4314.     esac
  4315.     ;;
  4316. esac
  4317. set d_dosuid
  4318. eval $setvar
  4319.  
  4320. : see if drem exists
  4321. set drem d_drem
  4322. eval $inlibc
  4323.  
  4324. : see if dup2 exists
  4325. set dup2 d_dup2
  4326. eval $inlibc
  4327.  
  4328. : see if fchmod exists
  4329. set fchmod d_fchmod
  4330. eval $inlibc
  4331.  
  4332. : see if fchown exists
  4333. set fchown d_fchown
  4334. eval $inlibc
  4335.  
  4336. : see if this is an fcntl system
  4337. set fcntl d_fcntl
  4338. eval $inlibc
  4339.  
  4340. : see if fgetpos exists
  4341. set fgetpos d_fgetpos
  4342. eval $inlibc
  4343.  
  4344. : see if we can have long filenames
  4345. echo " "
  4346. rmlist="$rmlist /tmp/cf$$"
  4347. $test -d /tmp/cf$$ || mkdir /tmp/cf$$
  4348. first=123456789abcdef
  4349. second=/tmp/cf$$/$first
  4350. $rm -f $first $second
  4351. if (echo hi >$first) 2>/dev/null; then
  4352.     if $test -f 123456789abcde; then
  4353.         echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
  4354.         val="$undef"
  4355.     else
  4356.         if (echo hi >$second) 2>/dev/null; then
  4357.             if $test -f /tmp/cf$$/123456789abcde; then
  4358.                 $cat <<'EOM'
  4359. That's peculiar... You can have filenames longer than 14 characters, but only
  4360. on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
  4361. I shall consider your system cannot support long filenames at all.
  4362. EOM
  4363.                 val="$undef"
  4364.             else
  4365.                 echo 'You can have filenames longer than 14 characters.' >&4
  4366.                 val="$define"
  4367.             fi
  4368.         else
  4369.             $cat <<'EOM'
  4370. How confusing! Some of your filesystems are sane enough to allow filenames
  4371. longer than 14 characters but some others like /tmp can't even think about them.
  4372. So, for now on, I shall assume your kernel does not allow them at all.
  4373. EOM
  4374.             val="$undef"
  4375.         fi
  4376.     fi
  4377. else
  4378.     $cat <<'EOM'
  4379. You can't have filenames longer than 14 chars.  You can't even think about them!
  4380. EOM
  4381.     val="$undef"
  4382. fi 
  4383. set d_flexfnam
  4384. eval $setvar
  4385. $rm -rf /tmp/cf$$ 123456789abcde*
  4386.  
  4387. : see if flock exists
  4388. set flock d_flock
  4389. eval $inlibc
  4390.  
  4391. : see if fmod exists
  4392. set fmod d_fmod
  4393. eval $inlibc
  4394.  
  4395. : see if fork exists
  4396. set fork d_fork
  4397. eval $inlibc
  4398.  
  4399. : see if pathconf exists
  4400. set pathconf d_pathconf
  4401. eval $inlibc
  4402.  
  4403. : see if fpathconf exists
  4404. set fpathconf d_fpathconf
  4405. eval $inlibc
  4406.  
  4407. : see if fsetpos exists
  4408. set fsetpos d_fsetpos
  4409. eval $inlibc
  4410.  
  4411. : see if gethostent exists
  4412. set gethostent d_gethent
  4413. eval $inlibc
  4414.  
  4415. : see if getlogin exists
  4416. set getlogin d_getlogin
  4417. eval $inlibc
  4418.  
  4419. : see if getpgrp exists
  4420. set getpgrp d_getpgrp
  4421. eval $inlibc
  4422.  
  4423. : see if getpgrp2 exists
  4424. set getpgrp2 d_getpgrp2
  4425. eval $inlibc
  4426.  
  4427. : see if getppid exists
  4428. set getppid d_getppid
  4429. eval $inlibc
  4430.  
  4431. : see if getpriority exists
  4432. set getpriority d_getprior
  4433. eval $inlibc
  4434.  
  4435. : see if group exists
  4436. set group d_group
  4437. eval $inlibc
  4438.  
  4439. : see if this is a netinet/in.h or sys/in.h system
  4440. set netinet/in.h i_niin sys/in.h i_sysin
  4441. eval $inhdr
  4442.  
  4443. : see if htonl --and friends-- exists
  4444. val=''
  4445. set htonl val
  4446. eval $inlibc
  4447.  
  4448. : Maybe they are macros.
  4449. case "$val" in
  4450. $undef)
  4451.     $cat >htonl.c <<EOM
  4452. #include <stdio.h>
  4453. #include <sys/types.h>
  4454. #$i_niin I_NETINET_IN
  4455. #$i_sysin I_SYS_IN
  4456. #ifdef I_NETINET_IN
  4457. #include <netinet/in.h>
  4458. #endif
  4459. #ifdef I_SYS_IN
  4460. #include <sys/in.h>
  4461. #endif
  4462. #ifdef htonl
  4463. printf("Defined as a macro.");
  4464. #endif
  4465. EOM
  4466.     $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
  4467.     if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
  4468.         val="$define"
  4469.         echo "But it seems to be defined as a macro." >&4
  4470.     fi
  4471.     $rm -f htonl.?
  4472.     ;;
  4473. esac
  4474. set d_htonl
  4475. eval $setvar
  4476.  
  4477. : see which of string.h or strings.h is needed
  4478. echo " "
  4479. strings=`./findhdr string.h`
  4480. if $test "$strings" && $test -r "$strings"; then
  4481.     echo "Using <string.h> instead of <strings.h>." >&4
  4482.     val="$define"
  4483. else
  4484.     val="$undef"
  4485.     strings=`./findhdr strings.h`
  4486.     if $test "$strings" && $test -r "$strings"; then
  4487.         echo "Using <strings.h> instead of <string.h>." >&4
  4488.     else
  4489.         echo "No string header found -- You'll surely have problems." >&4
  4490.     fi
  4491. fi
  4492. set i_string
  4493. eval $setvar
  4494. case "$i_string" in
  4495. "$undef") strings=`./findhdr strings.h`;;
  4496. *)      strings=`./findhdr string.h`;;
  4497. esac
  4498.  
  4499. : index or strchr
  4500. echo " "
  4501. if set index val -f; eval $csym; $val; then
  4502.     if set strchr val -f d_strchr; eval $csym; $val; then
  4503.         if $contains strchr "$strings" >/dev/null 2>&1 ; then
  4504.             val="$define"
  4505.             vali="$undef"
  4506.             echo "strchr() found." >&4
  4507.         else
  4508.             val="$undef"
  4509.             vali="$define"
  4510.             echo "index() found." >&4
  4511.         fi
  4512.     else
  4513.         val="$undef"
  4514.         vali="$define"
  4515.         echo "index() found." >&4
  4516.     fi
  4517. else
  4518.     if set strchr val -f d_strchr; eval $csym; $val; then
  4519.         val="$define"
  4520.         vali="$undef"
  4521.         echo "strchr() found." >&4
  4522.     else
  4523.         echo "No index() or strchr() found!" >&4
  4524.         val="$undef"
  4525.         vali="$undef"
  4526.     fi
  4527. fi
  4528. set d_strchr; eval $setvar
  4529. val="$vali"
  4530. set d_index; eval $setvar
  4531.  
  4532. : Look for isascii
  4533. echo " "
  4534. $cat >isascii.c <<'EOCP'
  4535. #include <stdio.h>
  4536. #include <ctype.h>
  4537. main() {
  4538.     int c = 'A';
  4539.     if (isascii(c))
  4540.         exit(0);
  4541.     else
  4542.         exit(1);
  4543. }
  4544. EOCP
  4545. if $cc $ccflags $ldflags -o isascii isascii.c $libs >/dev/null 2>&1 ; then
  4546.     echo "isascii() found." >&4
  4547.     val="$define"
  4548. else
  4549.     echo "isascii() NOT found." >&4
  4550.     val="$undef"
  4551. fi
  4552. set d_isascii
  4553. eval $setvar
  4554. $rm -f isascii*
  4555.  
  4556. : see if killpg exists
  4557. set killpg d_killpg
  4558. eval $inlibc
  4559.  
  4560. : see if link exists
  4561. set link d_link
  4562. eval $inlibc
  4563.  
  4564. : see if stdio is really std
  4565. echo " "
  4566. xxx=`./findhdr stdio.h`
  4567. if $contains 'char.*_ptr;' "$xxx" >/dev/null 2>&1 ; then
  4568.     if $contains '_cnt;' "$xxx" >/dev/null 2>&1 ; then
  4569.         echo "Your stdio is pretty std." >&4
  4570.         val="$define"
  4571.     else
  4572.         echo "Your stdio isn't very std." >&4
  4573.         val="$undef"
  4574.     fi
  4575. else
  4576.     echo "Your stdio isn't very std." >&4
  4577.     val="$undef"
  4578. fi
  4579. set d_stdstdio
  4580. eval $setvar
  4581.  
  4582. : see if stdio is like that in linux
  4583. case "$d_stdstdio" in
  4584. "$undef")
  4585.     echo " "
  4586.     xxx=`./findhdr stdio.h`
  4587.     $cppstdin $cppflags $cppminus < "$xxx" > stdio.E
  4588.     if $contains 'char.*_IO_read_base' stdio.E >/dev/null 2>&1 && \
  4589.         $contains '_IO_read_ptr' stdio.E >/dev/null 2>&1 && \
  4590.         $contains '_IO_read_end' stdio.E >/dev/null 2>&1 ; then
  4591.             echo "Your stdio looks like linux." >&4
  4592.             val="$define"
  4593.     else
  4594.         echo "You don't have linux stdio, either." >&4
  4595.         val="$undef"
  4596.     fi
  4597.     $rm -f stdio.E
  4598.     ;;
  4599. *)    val="$undef" ;;
  4600. esac
  4601.  
  4602. set d_linuxstd
  4603. eval $setvar
  4604.  
  4605. : see if localeconv exists
  4606. set localeconv d_locconv
  4607. eval $inlibc
  4608.  
  4609. : see if lockf exists
  4610. set lockf d_lockf
  4611. eval $inlibc
  4612.  
  4613. : see if lstat exists
  4614. set lstat d_lstat
  4615. eval $inlibc
  4616.  
  4617. : see if mblen exists
  4618. set mblen d_mblen
  4619. eval $inlibc
  4620.  
  4621. : see if mbstowcs exists
  4622. set mbstowcs d_mbstowcs
  4623. eval $inlibc
  4624.  
  4625. : see if mbtowc exists
  4626. set mbtowc d_mbtowc
  4627. eval $inlibc
  4628.  
  4629. : see if memcmp exists
  4630. set memcmp d_memcmp
  4631. eval $inlibc
  4632.  
  4633. : see if memcpy exists
  4634. set memcpy d_memcpy
  4635. eval $inlibc
  4636.  
  4637. : see if memmove exists
  4638. set memmove d_memmove
  4639. eval $inlibc
  4640.  
  4641. : see if memset exists
  4642. set memset d_memset
  4643. eval $inlibc
  4644.  
  4645. : see if mkdir exists
  4646. set mkdir d_mkdir
  4647. eval $inlibc
  4648.  
  4649. : see if mkfifo exists
  4650. set mkfifo d_mkfifo
  4651. eval $inlibc
  4652.  
  4653. : see if mktime exists
  4654. set mktime d_mktime
  4655. eval $inlibc
  4656.  
  4657. : see if msgctl exists
  4658. set msgctl d_msgctl
  4659. eval $inlibc
  4660.  
  4661. : see if msgget exists
  4662. set msgget d_msgget
  4663. eval $inlibc
  4664.  
  4665. : see if msgsnd exists
  4666. set msgsnd d_msgsnd
  4667. eval $inlibc
  4668.  
  4669. : see if msgrcv exists
  4670. set msgrcv d_msgrcv
  4671. eval $inlibc
  4672.  
  4673. : see how much of the 'msg*(2)' library is present.
  4674. h_msg=true
  4675. echo " "
  4676. case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
  4677. *"$undef"*) h_msg=false;;
  4678. esac
  4679. : we could also check for sys/ipc.h ...
  4680. if $h_msg && $test `./findhdr sys/msg.h`; then
  4681.     echo "You have the full msg*(2) library." >&4
  4682.     val="$define"
  4683. else
  4684.     echo "You don't have the full msg*(2) library." >&4
  4685.     val="$undef"
  4686. fi
  4687. set d_msg
  4688. eval $setvar
  4689.  
  4690. : see if this is a malloc.h system
  4691. set malloc.h i_malloc
  4692. eval $inhdr
  4693.  
  4694. : determine which malloc to compile in
  4695. echo " "
  4696. case "$usemymalloc" in
  4697. ''|y*|true)    dflt='y' ;;
  4698. n*|false)    dflt='n' ;;
  4699. *)    dflt="$usemymalloc" ;;
  4700. esac
  4701. rp="Do you wish to attempt to use the malloc that comes with $package?"
  4702. . ./myread
  4703. usemymalloc="$ans"
  4704. case "$ans" in
  4705. y*|true)
  4706.     usemymalloc='y'
  4707.     mallocsrc='malloc.c'
  4708.     mallocobj='malloc.o'
  4709.     d_mymalloc="$define"
  4710.     case "$libs" in
  4711.     *-lmalloc*)
  4712.         : Remove malloc from list of libraries to use
  4713.         echo "Removing unneeded -lmalloc from library list" >&4
  4714.         set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
  4715.         shift
  4716.         libs="$*"
  4717.         echo "libs = $libs" >&4
  4718.         ;;
  4719.     esac
  4720.     ;;
  4721. *)
  4722.     usemymalloc='n'
  4723.     mallocsrc=''
  4724.     mallocobj=''
  4725.     d_mymalloc="$undef"
  4726.     ;;
  4727. esac
  4728.  
  4729. : compute the type returned by malloc
  4730. echo " "
  4731. case "$malloctype" in
  4732. '')
  4733.     $cat >malloc.c <<END
  4734. #$i_malloc I_MALLOC
  4735. #include <stdio.h>
  4736. #include <sys/types.h>
  4737. #ifdef I_MALLOC
  4738. #include <malloc.h>
  4739. #endif
  4740. void *malloc();
  4741. END
  4742.     if $cc $ccflags -c malloc.c >/dev/null 2>&1; then
  4743.         malloctype='void *'
  4744.     else
  4745.         malloctype='char *'
  4746.     fi
  4747.     $rm -f malloc.[co]
  4748.     ;;
  4749. esac
  4750. echo "Your system wants malloc to return '$malloctype', it would seem." >&4
  4751.  
  4752. : see if nice exists
  4753. set nice d_nice
  4754. eval $inlibc
  4755.  
  4756. : Locate the flags for 'open()'
  4757. echo " "
  4758. $cat >open3.c <<'EOCP'
  4759. #include <sys/types.h>
  4760. #ifdef I_FCNTL
  4761. #include <fcntl.h>
  4762. #endif
  4763. #ifdef I_SYS_FILE
  4764. #include <sys/file.h>
  4765. #endif
  4766. main() {
  4767.     if(O_RDONLY);
  4768. #ifdef O_TRUNC
  4769.     exit(0);
  4770. #else
  4771.     exit(1);
  4772. #endif
  4773. }
  4774. EOCP
  4775. : check sys/file.h first to get FREAD on Sun
  4776. if $test `./findhdr sys/file.h` && \
  4777.         $cc $cppflags "-DI_SYS_FILE" open3.c -o open3 >/dev/null 2>&1 ; then
  4778.     h_sysfile=true;
  4779.     echo "<sys/file.h> defines the O_* constants..." >&4
  4780.     if ./open3; then
  4781.         echo "and you have the 3 argument form of open()." >&4
  4782.         val="$define"
  4783.     else
  4784.         echo "but not the 3 argument form of open().  Oh, well." >&4
  4785.         val="$undef"
  4786.     fi
  4787. elif $test `./findhdr fcntl.h` && \
  4788.         $cc "-DI_FCNTL" open3.c -o open3 >/dev/null 2>&1 ; then
  4789.     h_fcntl=true;
  4790.     echo "<fcntl.h> defines the O_* constants..." >&4
  4791.     if ./open3; then
  4792.         echo "and you have the 3 argument form of open()." >&4
  4793.         val="$define"
  4794.     else
  4795.         echo "but not the 3 argument form of open().  Oh, well." >&4
  4796.         val="$undef"
  4797.     fi
  4798. else
  4799.     val="$undef"
  4800.     echo "I can't find the O_* constant definitions!  You got problems." >&4
  4801. fi
  4802. set d_open3
  4803. eval $setvar
  4804. $rm -f open3*
  4805.  
  4806. : see if passwd exists
  4807. set passwd d_passwd
  4808. eval $inlibc
  4809.  
  4810. : see if pause exists
  4811. set pause d_pause
  4812. eval $inlibc
  4813.  
  4814. : see if pipe exists
  4815. set pipe d_pipe
  4816. eval $inlibc
  4817.  
  4818. : see if this is a pwd system
  4819. echo " "
  4820. xxx=`./findhdr pwd.h`
  4821. if $test "$xxx"; then
  4822.     i_pwd="$define"
  4823.     echo "<pwd.h> found." >&4
  4824.     $cppstdin $cppflags $cppminus < $xxx >$$.h
  4825.     if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
  4826.         d_pwquota="$define"
  4827.     else
  4828.         d_pwquota="$undef"
  4829.     fi
  4830.     if $contains 'pw_age' $$.h >/dev/null 2>&1; then
  4831.         d_pwage="$define"
  4832.     else
  4833.         d_pwage="$undef"
  4834.     fi
  4835.     if $contains 'pw_change' $$.h >/dev/null 2>&1; then
  4836.         d_pwchange="$define"
  4837.     else
  4838.         d_pwchange="$undef"
  4839.     fi
  4840.     if $contains 'pw_class' $$.h >/dev/null 2>&1; then
  4841.         d_pwclass="$define"
  4842.     else
  4843.         d_pwclass="$undef"
  4844.     fi
  4845.     if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
  4846.         d_pwexpire="$define"
  4847.     else
  4848.         d_pwexpire="$undef"
  4849.     fi
  4850.     if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
  4851.         d_pwcomment="$define"
  4852.     else
  4853.         d_pwcomment="$undef"
  4854.     fi
  4855.     $rm -f $$.h
  4856. else
  4857.     i_pwd="$undef"
  4858.     d_pwquota="$undef"
  4859.     d_pwage="$undef"
  4860.     d_pwchange="$undef"
  4861.     d_pwclass="$undef"
  4862.     d_pwexpire="$undef"
  4863.     d_pwcomment="$undef"
  4864.     echo "<pwd.h> NOT found." >&4
  4865. fi
  4866.  
  4867. : see if readdir and friends exist
  4868. set readdir d_readdir
  4869. eval $inlibc
  4870. set seekdir d_seekdir
  4871. eval $inlibc
  4872. set telldir d_telldir
  4873. eval $inlibc
  4874. set rewinddir d_rewinddir
  4875. eval $inlibc
  4876.  
  4877. : see if readlink exists
  4878. set readlink d_readlink
  4879. eval $inlibc
  4880.  
  4881. : see if rename exists
  4882. set rename d_rename
  4883. eval $inlibc
  4884.  
  4885. : see if rmdir exists
  4886. set rmdir d_rmdir
  4887. eval $inlibc
  4888.  
  4889. : can bcopy handle overlapping blocks?
  4890. val="$undef"
  4891. case "$d_bcopy" in
  4892. "$define")
  4893.     echo " "
  4894.     echo "Checking to see if your bcopy() can do overlapping copies..." >&4
  4895.     $cat >foo.c <<'EOCP'
  4896. main()
  4897. {
  4898. char buf[128], abc[128];
  4899. char *b;
  4900. int len;
  4901. int off;
  4902. int align;
  4903.  
  4904. bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
  4905.  
  4906. for (align = 7; align >= 0; align--) {
  4907.     for (len = 36; len; len--) {
  4908.         b = buf+align;
  4909.         bcopy(abc, b, len);
  4910.         for (off = 1; off <= len; off++) {
  4911.             bcopy(b, b+off, len);
  4912.             bcopy(b+off, b, len);
  4913.             if (bcmp(b, abc, len))
  4914.                 exit(1);
  4915.         }
  4916.     }
  4917. }
  4918. exit(0);
  4919. }
  4920. EOCP
  4921.     if $cc foo.c -o safebcpy $ccflags $ldflags $libs >/dev/null 2>&1 ; then
  4922.         if ./safebcpy 2>/dev/null; then
  4923.             echo "Yes, it can."
  4924.             val="$define"
  4925.         else
  4926.             echo "It can't, sorry."
  4927.         fi
  4928.     else
  4929.         echo "(I can't compile the test program, so we'll assume not...)"
  4930.     fi
  4931.     ;;
  4932. esac
  4933. $rm -f foo.* safebcpy core
  4934. set d_safebcpy
  4935. eval $setvar
  4936.  
  4937. : can memcpy handle overlapping blocks?
  4938. val="$undef"
  4939. case "$d_memcpy" in
  4940. "$define")
  4941.     echo " "
  4942.     echo "Checking to see if your memcpy() can do overlapping copies..." >&4
  4943.     $cat >foo.c <<'EOCP'
  4944. main()
  4945. {
  4946. char buf[128], abc[128];
  4947. char *b;
  4948. int len;
  4949. int off;
  4950. int align;
  4951.  
  4952. memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
  4953.  
  4954. for (align = 7; align >= 0; align--) {
  4955.     for (len = 36; len; len--) {
  4956.         b = buf+align;
  4957.         memcpy(abc, b, len);
  4958.         for (off = 1; off <= len; off++) {
  4959.             memcpy(b, b+off, len);
  4960.             memcpy(b+off, b, len);
  4961.             if (memcmp(b, abc, len))
  4962.                 exit(1);
  4963.         }
  4964.     }
  4965. }
  4966. exit(0);
  4967. }
  4968. EOCP
  4969.     if $cc foo.c -o safemcpy $ccflags $ldflags $libs >/dev/null 2>&1 ; then
  4970.         if ./safemcpy 2>/dev/null; then
  4971.             echo "Yes, it can."
  4972.             val="$define"
  4973.         else
  4974.             echo "It can't, sorry."
  4975.         fi
  4976.     else
  4977.         echo "(I can't compile the test program, so we'll assume not...)"
  4978.     fi
  4979.     ;;
  4980. esac
  4981. $rm -f foo.* safemcpy core
  4982. set d_safemcpy
  4983. eval $setvar
  4984.  
  4985. : see if select exists
  4986. set select d_select
  4987. eval $inlibc
  4988.  
  4989. : see if semctl exists
  4990. set semctl d_semctl
  4991. eval $inlibc
  4992.  
  4993. : see if semget exists
  4994. set semget d_semget
  4995. eval $inlibc
  4996.  
  4997. : see if semop exists
  4998. set semop d_semop
  4999. eval $inlibc
  5000.  
  5001. : see how much of the 'sem*(2)' library is present.
  5002. h_sem=true
  5003. echo " "
  5004. case "$d_semctl$d_semget$d_semop" in
  5005. *"$undef"*) h_sem=false;;
  5006. esac
  5007. : we could also check for sys/ipc.h ...
  5008. if $h_sem && $test `./findhdr sys/sem.h`; then
  5009.     echo "You have the full sem*(2) library." >&4
  5010.     val="$define"
  5011. else
  5012.     echo "You don't have the full sem*(2) library." >&4
  5013.     val="$undef"
  5014. fi
  5015. set d_sem
  5016. eval $setvar
  5017.  
  5018. : see if setegid exists
  5019. set setegid d_setegid
  5020. eval $inlibc
  5021.  
  5022. : see if seteuid exists
  5023. set seteuid d_seteuid
  5024. eval $inlibc
  5025.  
  5026. : see if setlinebuf exists
  5027. set setlinebuf d_setlinebuf
  5028. eval $inlibc
  5029.  
  5030. : see if setlocale exists
  5031. set setlocale d_setlocale
  5032. eval $inlibc
  5033.  
  5034. : see if setpgid exists
  5035. set setpgid d_setpgid
  5036. eval $inlibc
  5037.  
  5038. : see if setpgrp2 exists
  5039. set setpgrp2 d_setpgrp2
  5040. eval $inlibc
  5041.  
  5042. : see if setpriority exists
  5043. set setpriority d_setprior
  5044. eval $inlibc
  5045.  
  5046. : see if setregid exists
  5047. set setregid d_setregid
  5048. eval $inlibc
  5049. set setresgid d_setresgid
  5050. eval $inlibc
  5051.  
  5052. : see if setreuid exists
  5053. set setreuid d_setreuid
  5054. eval $inlibc
  5055. set setresuid d_setresuid
  5056. eval $inlibc
  5057.  
  5058. : see if setrgid exists
  5059. set setrgid d_setrgid
  5060. eval $inlibc
  5061.  
  5062. : see if setruid exists
  5063. set setruid d_setruid
  5064. eval $inlibc
  5065.  
  5066. : see if setsid exists
  5067. set setsid d_setsid
  5068. eval $inlibc
  5069.  
  5070. : see if shmctl exists
  5071. set shmctl d_shmctl
  5072. eval $inlibc
  5073.  
  5074. : see if shmget exists
  5075. set shmget d_shmget
  5076. eval $inlibc
  5077.  
  5078. : see if shmat exists
  5079. set shmat d_shmat
  5080. eval $inlibc
  5081. : see what shmat returns
  5082. case "$d_shmat" in
  5083. "$define")
  5084.     $cat >shmat.c <<'END'
  5085. #include <sys/shm.h>
  5086. void *shmat();
  5087. END
  5088.     if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
  5089.         shmattype='void *'
  5090.     else
  5091.         shmattype='char *'
  5092.     fi
  5093.     echo "and it returns ($shmattype)." >&4
  5094.     : see if a prototype for shmat is available
  5095.     $cppstdin $cppflags $cppminus < $usrinc/sys/shm.h > shmat.c 2>/dev/null
  5096.     if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
  5097.         val="$define"
  5098.     else
  5099.         val="$undef"
  5100.     fi
  5101.     $rm -f shmat.[co]
  5102.     ;;
  5103. *)
  5104.     val="$undef"
  5105.     ;;
  5106. esac
  5107. set d_shmatprototype
  5108. eval $setvar
  5109.  
  5110. : see if shmdt exists
  5111. set shmdt d_shmdt
  5112. eval $inlibc
  5113.  
  5114. : see how much of the 'shm*(2)' library is present.
  5115. h_shm=true
  5116. echo " "
  5117. case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
  5118. *"$undef"*) h_shm=false;;
  5119. esac
  5120. : we could also check for sys/ipc.h ...
  5121. if $h_shm && $test `./findhdr sys/shm.h`; then
  5122.     echo "You have the full shm*(2) library." >&4
  5123.     val="$define"
  5124. else
  5125.     echo "You don't have the full shm*(2) library." >&4
  5126.     val="$undef"
  5127. fi
  5128. set d_shm
  5129. eval $setvar
  5130.  
  5131. socketlib=''
  5132. sockethdr=''
  5133. : see whether socket exists
  5134. echo " "
  5135. $echo $n "Hmm... $c" >&4
  5136. if set socket val -f d_socket; eval $csym; $val; then
  5137.     echo "Looks like you have Berkeley networking support." >&4
  5138.     d_socket="$define"
  5139.     if set setsockopt val -f; eval $csym; $val; then
  5140.         d_oldsock="$undef"
  5141.     else
  5142.         echo "...but it uses the old 4.1c interface, rather than 4.2" >&4
  5143.         d_oldsock="$define"
  5144.     fi
  5145. else
  5146.     if $contains socklib libc.list >/dev/null 2>&1; then
  5147.         echo "Looks like you have Berkeley networking support." >&4
  5148.         d_socket="$define"
  5149.         : we will have to assume that it supports the 4.2 BSD interface
  5150.         d_oldsock="$undef"
  5151.     else
  5152.         echo "You don't have Berkeley networking in libc.a..." >&4
  5153.         if test -f /usr/lib/libnet.a; then
  5154.             ( (nm $nm_opt /usr/lib/libnet.a | eval $nm_extract) ||  \
  5155.             ar t /usr/lib/libnet.a) 2>/dev/null >> libc.list
  5156.             if $contains socket libc.list >/dev/null 2>&1; then
  5157.             echo "...but the Wollongong group seems to have hacked it in." >&4
  5158.                 socketlib="-lnet"
  5159.                 sockethdr="-I/usr/netinclude"
  5160.                 d_socket="$define"
  5161.                 if $contains setsockopt libc.list >/dev/null 2>&1; then
  5162.                     d_oldsock="$undef"
  5163.                 else
  5164.                     echo "...using the old 4.1c interface, rather than 4.2" >&4
  5165.                     d_oldsock="$define"
  5166.                 fi
  5167.             else
  5168.                 echo "or even in libnet.a, which is peculiar." >&4
  5169.                 d_socket="$undef"
  5170.                 d_oldsock="$undef"
  5171.             fi
  5172.         else
  5173.             echo "or anywhere else I see." >&4
  5174.             d_socket="$undef"
  5175.             d_oldsock="$undef"
  5176.         fi
  5177.     fi
  5178. fi
  5179.  
  5180. : see if socketpair exists
  5181. set socketpair d_sockpair
  5182. eval $inlibc
  5183.  
  5184. : see if stat knows about block sizes
  5185. echo " "
  5186. xxx=`./findhdr sys/stat.h`
  5187. if $contains 'st_blocks;' "$xxx" >/dev/null 2>&1 ; then
  5188.     if $contains 'st_blksize;' "$xxx" >/dev/null 2>&1 ; then
  5189.         echo "Your stat() knows about block sizes." >&4
  5190.         val="$define"
  5191.     else
  5192.         echo "Your stat() doesn't know about block sizes." >&4
  5193.         val="$undef"
  5194.     fi
  5195. else
  5196.     echo "Your stat() doesn't know about block sizes." >&4
  5197.     val="$undef"
  5198. fi
  5199. set d_statblks
  5200. eval $setvar
  5201.  
  5202. : see if strcoll exists
  5203. set strcoll d_strcoll
  5204. eval $inlibc
  5205.  
  5206. : check for structure copying
  5207. echo " "
  5208. echo "Checking to see if your C compiler can copy structs..." >&4
  5209. $cat >try.c <<'EOCP'
  5210. main()
  5211. {
  5212.     struct blurfl {
  5213.         int dyick;
  5214.     } foo, bar;
  5215.  
  5216.     foo = bar;
  5217. }
  5218. EOCP
  5219. if $cc -c try.c >/dev/null 2>&1 ; then
  5220.     val="$define"
  5221.     echo "Yup, it can."
  5222. else
  5223.     val="$undef"
  5224.     echo "Nope, it can't."
  5225. fi
  5226. set d_strctcpy
  5227. eval $setvar
  5228. $rm -f try.*
  5229.  
  5230. : see if strerror and/or sys_errlist[] exist
  5231. echo " "
  5232. if set strerror val -f d_strerror; eval $csym; $val; then
  5233.     echo 'strerror() found.' >&4
  5234.     d_strerror="$define"
  5235.     d_strerrm='strerror(e)'
  5236.     if set sys_errlist val -a d_syserrlst; eval $csym; $val; then    
  5237.         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
  5238.         d_syserrlst="$define"
  5239.     else
  5240.     echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
  5241.         d_syserrlst="$undef"
  5242.     fi
  5243. elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
  5244.     $contains '#[     ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
  5245.     echo 'strerror() found in string header.' >&4
  5246.     d_strerror="$define"
  5247.     d_strerrm='strerror(e)'
  5248.     if set sys_errlist val -a d_syserrlst; eval $csym; $val; then    
  5249.         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
  5250.         d_syserrlst="$define"
  5251.     else
  5252.         echo "(You don't appear to have any sys_errlist[], how can this be?)"
  5253.         d_syserrlst="$undef"
  5254.     fi
  5255. elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
  5256. echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
  5257.     d_strerror="$undef"
  5258.     d_syserrlst="$define"
  5259.     d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
  5260. else
  5261.     echo 'strerror() and sys_errlist[] NOT found.' >&4
  5262.     d_strerror="$undef"
  5263.     d_syserrlst="$undef"
  5264.     d_strerrm='"unknown"'
  5265. fi
  5266.  
  5267. : see if strxfrm exists
  5268. set strxfrm d_strxfrm
  5269. eval $inlibc
  5270.  
  5271. : see if symlink exists
  5272. set symlink d_symlink
  5273. eval $inlibc
  5274.  
  5275. : see if syscall exists
  5276. set syscall d_syscall
  5277. eval $inlibc
  5278.  
  5279. : see if sysconf exists
  5280. set sysconf d_sysconf
  5281. eval $inlibc
  5282.  
  5283. : see if system exists
  5284. set system d_system
  5285. eval $inlibc
  5286.  
  5287. : see if tcgetpgrp exists
  5288. set tcgetpgrp d_tcgetpgrp
  5289. eval $inlibc
  5290.  
  5291. : see if tcsetpgrp exists
  5292. set tcsetpgrp d_tcsetpgrp
  5293. eval $inlibc
  5294.  
  5295. : define an is-a-typedef? function
  5296. typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
  5297. case "$inclist" in
  5298. "") inclist="sys/types.h";;
  5299. esac;
  5300. eval "val=\$$var";
  5301. case "$val" in
  5302. "")
  5303.     $rm -f temp.c;
  5304.     for inc in $inclist; do
  5305.         echo "#include <$inc>" >>temp.c;
  5306.     done;
  5307.     $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
  5308.     if $contains $type temp.E >/dev/null 2>&1; then
  5309.         eval "$var=$type";
  5310.     else
  5311.         eval "$var=$def";
  5312.     fi;
  5313.     $rm -f temp.?;;
  5314. *) eval "$var=$val";;
  5315. esac'
  5316.  
  5317. : see if this is a sys/times.h system
  5318. set sys/times.h i_systimes
  5319. eval $inhdr
  5320.  
  5321. : see if times exists
  5322. echo " "
  5323. if set times val -f d_times; eval $csym; $val; then
  5324.     echo 'times() found.' >&4
  5325.     d_times="$define"
  5326.     inc=''
  5327.     case "$i_systimes" in
  5328.     "$define") inc='sys/times.h';;
  5329.     esac
  5330.     set clock_t clocktype long stdio.h sys/types.h $inc
  5331.     eval $typedef
  5332.     dflt="$clocktype"
  5333.     echo " "
  5334.     rp="What type is returned by times() on this sytem?"
  5335.     . ./myread
  5336.     clocktype="$ans"
  5337. else
  5338.     echo 'times() NOT found, hope that will do.' >&4
  5339.     d_times="$undef"
  5340.     clocktype='int'
  5341. fi
  5342.  
  5343. : see if truncate exists
  5344. set truncate d_truncate
  5345. eval $inlibc
  5346.  
  5347. : see if tzname[] exists
  5348. echo " "
  5349. if set tzname val -a d_tzname; eval $csym; $val; then
  5350.     val="$define"
  5351.     echo 'tzname[] found.' >&4
  5352. else
  5353.     val="$undef"
  5354.     echo 'tzname[] NOT found.' >&4
  5355. fi
  5356. set d_tzname
  5357. eval $setvar
  5358.  
  5359. : see if umask exists
  5360. set umask d_umask
  5361. eval $inlibc
  5362.  
  5363. : see if we have to deal with yellow pages, now NIS.
  5364. if $test -d /usr/etc/yp || $test -d /etc/yp; then
  5365.     if $test -f /usr/etc/nibindd; then
  5366.         echo " "
  5367.         echo "I'm fairly confident you're on a NeXT."
  5368.         echo " "
  5369.         rp='Do you get the hosts file via NetInfo?'
  5370.         dflt=y
  5371.         case "$hostcat" in
  5372.         nidump*) ;;
  5373.         '') ;;
  5374.         *) dflt=n;;
  5375.         esac
  5376.         . ./myread
  5377.         case "$ans" in
  5378.         y*) hostcat='nidump hosts .';;
  5379.         *) hostcat='cat /etc/hosts';;
  5380.         esac
  5381.     fi
  5382.     case "$hostcat" in
  5383.     nidump*) ;;
  5384.     *)
  5385.         case "$hostcat" in
  5386.         *ypcat*) dflt=y;;
  5387.         '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
  5388.                 dflt=y
  5389.             else
  5390.                 dflt=n
  5391.             fi;;
  5392.         *) dflt=n;;
  5393.         esac
  5394.         echo " "
  5395.         rp='Are you getting the hosts file via yellow pages?'
  5396.         . ./myread
  5397.         case "$ans" in
  5398.         y*) hostcat='ypcat hosts';;
  5399.         *) hostcat='cat /etc/hosts';;
  5400.         esac
  5401.         ;;
  5402.     esac
  5403. fi
  5404.  
  5405. : now get the host name
  5406. echo " "
  5407. echo "Figuring out host name..." >&4
  5408. case "$myhostname" in
  5409. '') cont=true
  5410.     echo 'Maybe "hostname" will work...'
  5411.     if tans=`sh -c hostname 2>&1` ; then
  5412.         myhostname=$tans
  5413.         phostname=hostname
  5414.         cont=''
  5415.     fi
  5416.     ;;
  5417. *) cont='';;
  5418. esac
  5419. if $test "$cont"; then
  5420.     if xenix; then
  5421.         echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
  5422.         if tans=`cat /etc/systemid 2>&1` ; then
  5423.             myhostname=$tans
  5424.             phostname='cat /etc/systemid'
  5425.             echo "Whadyaknow.  Xenix always was a bit strange..."
  5426.             cont=''
  5427.         fi
  5428.     elif $test -r /etc/systemid; then
  5429.         echo "(What is a non-Xenix system doing with /etc/systemid?)"
  5430.     fi
  5431. fi
  5432. if $test "$cont"; then
  5433.     echo 'No, maybe "uuname -l" will work...'
  5434.     if tans=`sh -c 'uuname -l' 2>&1` ; then
  5435.         myhostname=$tans
  5436.         phostname='uuname -l'
  5437.     else
  5438.         echo 'Strange.  Maybe "uname -n" will work...'
  5439.         if tans=`sh -c 'uname -n' 2>&1` ; then
  5440.             myhostname=$tans
  5441.             phostname='uname -n'
  5442.         else
  5443.             echo 'Oh well, maybe I can mine it out of whoami.h...'
  5444.             if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
  5445.                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
  5446.                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
  5447.             else
  5448.                 case "$myhostname" in
  5449.                 '') echo "Does this machine have an identity crisis or something?"
  5450.                     phostname='';;
  5451.                 *)
  5452.                     echo "Well, you said $myhostname before..."
  5453.                     phostname='echo $myhostname';;
  5454.                 esac
  5455.             fi
  5456.         fi
  5457.     fi
  5458. fi
  5459. : you do not want to know about this
  5460. set $myhostname
  5461. myhostname=$1
  5462.  
  5463. : translate upper to lower if necessary
  5464. case "$myhostname" in
  5465. *[A-Z]*)
  5466.     echo "(Normalizing case in your host name)"
  5467.     myhostname=`echo $myhostname | tr '[A-Z]' '[a-z]'`
  5468.     ;;
  5469. esac
  5470.  
  5471. : verify guess
  5472. if $test "$myhostname" ; then
  5473.     dflt=y
  5474.     rp='Your host name appears to be "'$myhostname'".'" Right?"
  5475.     . ./myread
  5476.     case "$ans" in
  5477.     y*) ;;
  5478.     *) myhostname='';;
  5479.     esac
  5480. fi
  5481.  
  5482. : bad guess or no guess
  5483. while $test "X$myhostname" = X ; do
  5484.     dflt=''
  5485.     rp="Please type the (one word) name of your host:"
  5486.     . ./myread
  5487.     myhostname="$ans"
  5488. done
  5489.  
  5490. : a little sanity check here
  5491. case "$phostname" in
  5492. '') ;;
  5493. *)
  5494.     case `$phostname | tr '[A-Z]' '[a-z]'` in
  5495.     $myhostname$mydomain|$myhostname) ;;
  5496.     *)
  5497.         case "$phostname" in
  5498.         sed*)
  5499.             echo "(That doesn't agree with your whoami.h file, by the way.)"
  5500.             ;;
  5501.         *)
  5502.             echo "(That doesn't agree with your $phostname command, by the way.)"
  5503.             ;;
  5504.         esac
  5505.     ;;
  5506.     esac
  5507.     ;;
  5508. esac
  5509.  
  5510. : see how we will look up host name
  5511. echo " "
  5512. if false; then
  5513.     : dummy stub to allow use of elif
  5514. elif set uname val -f d_uname; eval $csym; $val; then
  5515.     if xenix; then
  5516.         $cat <<'EOM'
  5517. uname() was found, but you're running xenix, and older versions of xenix
  5518. have a broken uname(). If you don't really know whether your xenix is old
  5519. enough to have a broken system call, use the default answer.
  5520.  
  5521. EOM
  5522.         dflt=y
  5523.         case "$d_uname" in
  5524.         "$define") dflt=n;;
  5525.         esac
  5526.         rp='Is your uname() broken?'
  5527.         . ./myread
  5528.         case "$ans" in
  5529.         n*) d_uname="$define"; call=uname;;
  5530.         esac
  5531.     else
  5532.         echo 'uname() found.' >&4
  5533.         d_uname="$define"
  5534.         call=uname
  5535.     fi
  5536. fi
  5537. case "$d_gethname" in
  5538. '') d_gethname="$undef";;
  5539. esac
  5540. case "$d_uname" in
  5541. '') d_uname="$undef";;
  5542. esac
  5543. case "$d_phostname" in
  5544. '') d_phostname="$undef";;
  5545. esac
  5546.  
  5547. : backward compatibility for d_hvfork
  5548. if test X$d_hvfork != X; then
  5549.     d_vfork="$d_hvfork"
  5550.     d_hvfork=''
  5551. fi
  5552. : see if there is a vfork
  5553. val=''
  5554. set vfork val
  5555. eval $inlibc
  5556.  
  5557. : Ok, but do we want to use it. vfork is reportedly unreliable in 
  5558. : perl on Solaris 2.x, and probably elsewhere.
  5559. case "$val" in
  5560. $define)
  5561.     echo " "
  5562.     case "$usevfork" in
  5563.     false) dflt='n';;
  5564.     *) dflt='y';;
  5565.     esac
  5566.     rp="Some systems have problems with vfork().  Do you want to use it?"
  5567.     . ./myread
  5568.     case "$ans" in
  5569.     y|Y) ;;
  5570.     *)
  5571.         echo "Ok, we won't use vfork()."
  5572.         val="$undef"
  5573.         ;;
  5574.     esac
  5575.     ;;
  5576. esac
  5577. set d_vfork
  5578. eval $setvar
  5579. case "$d_vfork" in
  5580. $define) usevfork='true';;
  5581. *) usevfork='false';;
  5582. esac
  5583.  
  5584. : see if this is an sysdir system
  5585. set sys/dir.h i_sysdir
  5586. eval $inhdr
  5587.  
  5588. : see if this is an sysndir system
  5589. set sys/ndir.h i_sysndir
  5590. eval $inhdr
  5591.  
  5592. : see if closedir exists
  5593. set closedir d_closedir
  5594. eval $inlibc
  5595.  
  5596. case "$d_closedir" in
  5597. "$define")
  5598.     echo " "
  5599.     echo "Checking whether closedir() returns a status..." >&4
  5600.     cat > closedir.c <<EOM
  5601. #$i_dirent I_DIRENT        /**/
  5602. #$i_sysdir I_SYS_DIR        /**/
  5603. #$i_sysndir I_SYS_NDIR        /**/
  5604.  
  5605. #if defined(I_DIRENT)
  5606. #include <dirent.h>
  5607. #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
  5608. #include <sys/dir.h>
  5609. #endif
  5610. #else
  5611. #ifdef I_SYS_NDIR
  5612. #include <sys/ndir.h>
  5613. #else
  5614. #ifdef I_SYS_DIR
  5615. #ifdef hp9000s500
  5616. #include <ndir.h>    /* may be wrong in the future */
  5617. #else
  5618. #include <sys/dir.h>
  5619. #endif
  5620. #endif
  5621. #endif
  5622. #endif 
  5623. int main() { return closedir(opendir(".")); }
  5624. EOM
  5625.     if $cc $ccflags $ldflags -o closedir closedir.c $libs > /dev/null 2>&1; then
  5626.         if ./closedir > /dev/null 2>&1 ; then
  5627.             echo "Yes, it does."
  5628.             val="$undef"
  5629.         else
  5630.             echo "No, it doesn't."
  5631.             val="$define"
  5632.         fi
  5633.     else
  5634.         echo "(I can't seem to compile the test program--assuming it doesn't)"
  5635.         val="$define"
  5636.     fi
  5637.     ;;
  5638. *)
  5639.     val="$undef";
  5640.     ;;
  5641. esac
  5642. set d_void_closedir
  5643. eval $setvar
  5644. $rm -f closedir*
  5645. : see if signal is declared as pointer to function returning int or void
  5646. echo " "
  5647. xxx=`./findhdr signal.h`
  5648. $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
  5649. if $contains 'int.*\*[     ]*signal' $$.tmp >/dev/null 2>&1 ; then
  5650.     echo "You have int (*signal())() instead of void." >&4
  5651.     val="$undef"
  5652. elif $contains 'void.*\*[     ]*signal' $$.tmp >/dev/null 2>&1 ; then
  5653.     echo "You have void (*signal())() instead of int." >&4
  5654.     val="$define"
  5655. elif $contains 'extern[     ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
  5656.     echo "You have int (*signal())() instead of void." >&4
  5657.     val="$undef"
  5658. else
  5659.     case "$d_voidsig" in
  5660.     '')
  5661.     echo "I can't determine whether signal handler returns void or int..." >&4
  5662.         dflt=void
  5663.         rp="What type does your signal handler return?"
  5664.         . ./myread
  5665.         case "$ans" in
  5666.         v*) val="$define";;
  5667.         *) val="$undef";;
  5668.         esac;;
  5669.     "$define")
  5670.         echo "As you already told me, signal handler returns void." >&4;;
  5671.     *)
  5672.         echo "As you already told me, signal handler returns int." >&4;;
  5673.     esac
  5674. fi
  5675. set d_voidsig
  5676. eval $setvar
  5677. case "$d_voidsig" in
  5678. "$define") signal_t="void";;
  5679. *) signal_t="int";;
  5680. esac
  5681. $rm -f $$.tmp
  5682.  
  5683. : check for volatile keyword
  5684. echo " "
  5685. echo 'Checking to see if your C compiler knows about "volatile"...' >&4
  5686. $cat >try.c <<'EOCP'
  5687. main()
  5688. {
  5689.     typedef struct _goo_struct goo_struct;
  5690.     goo_struct * volatile goo = ((goo_struct *)0);
  5691.     struct _goo_struct {
  5692.         long long_int;
  5693.         int reg_int;
  5694.         char char_var;
  5695.     };
  5696.     typedef unsigned short foo_t;
  5697.     char *volatile foo;
  5698.     volatile int bar;
  5699.     volatile foo_t blech;
  5700.     foo = foo;
  5701. }
  5702. EOCP
  5703. if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
  5704.     val="$define"
  5705.     echo "Yup, it does."
  5706. else
  5707.     val="$undef"
  5708.     echo "Nope, it doesn't."
  5709. fi
  5710. set d_volatile
  5711. eval $setvar
  5712. $rm -f try.*
  5713.  
  5714. : see if there is a wait4
  5715. set wait4 d_wait4
  5716. eval $inlibc
  5717.  
  5718. : see if waitpid exists
  5719. set waitpid d_waitpid
  5720. eval $inlibc
  5721.  
  5722. : see if wcstombs exists
  5723. set wcstombs d_wcstombs
  5724. eval $inlibc
  5725.  
  5726. : see if wctomb exists
  5727. set wctomb d_wctomb
  5728. eval $inlibc
  5729.  
  5730. : preserve RCS keywords in files with variable substitution, grrr
  5731. Date='$Date'
  5732. Id='$Id'
  5733. Log='$Log'
  5734. RCSfile='$RCSfile'
  5735. Revision='$Revision'
  5736.  
  5737. : check for alignment requirements
  5738. echo " "
  5739. case "$alignbytes" in
  5740. '') echo "Checking alignment constraints..." >&4
  5741.     $cat >try.c <<'EOCP'
  5742. struct foobar {
  5743.     char foo;
  5744.     double bar;
  5745. } try;
  5746. main()
  5747. {
  5748.     printf("%d\n", (char *)&try.bar - (char *)&try.foo);
  5749. }
  5750. EOCP
  5751.     if $cc $ccflags try.c -o try >/dev/null 2>&1; then
  5752.         dflt=`./try`
  5753.     else
  5754.         dflt='8'
  5755.         echo"(I can't seem to compile the test program...)"
  5756.     fi
  5757.     ;;
  5758. *) dflt="$alignbytes"
  5759.     ;;
  5760. esac
  5761. rp="Doubles must be aligned on a how-many-byte boundary?"
  5762. . ./myread
  5763. alignbytes="$ans"
  5764. $rm -f try.c try
  5765.  
  5766. : determine where public executables go
  5767. echo " "
  5768. case "$bin" in
  5769. '')
  5770.     dflt="$prefix/bin"
  5771.     ;;
  5772. *)
  5773.     dflt="$bin"
  5774.     ;;
  5775. esac
  5776. fn=d~
  5777. rp='Pathname where the public executables will reside?'
  5778. . ./getfile
  5779. bin="$ans"
  5780. binexp="$ansexp"
  5781. if $afs; then
  5782.     $cat <<EOM
  5783.  
  5784. Since you are running AFS, I need to distinguish the directory in which
  5785. executables reside from the directory in which they are installed (and from
  5786. which they are presumably copied to the former directory by occult means).
  5787.  
  5788. EOM
  5789.     case "$installbin" in
  5790.     '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;;
  5791.     *) dflt="$installbin";;
  5792.     esac
  5793.     fn=de~
  5794.     rp='Where will public executables be installed?'
  5795.     . ./getfile
  5796.     installbin="$ans"
  5797. else
  5798.     installbin="$binexp"
  5799. fi
  5800.  
  5801. : check for ordering of bytes in a long
  5802. case "$byteorder" in
  5803. '')
  5804.     $cat <<'EOM'
  5805.   
  5806. In the following, larger digits indicate more significance.  A big-endian
  5807. machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
  5808. little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
  5809. machines may have weird orders like 3412.  A Cray will report 87654321. If
  5810. the test program works the default is probably right.
  5811. I'm now running the test program...
  5812. EOM
  5813.     $cat >try.c <<'EOCP'
  5814. #include <stdio.h>
  5815. main()
  5816. {
  5817.     int i;
  5818.     union {
  5819.         unsigned long l;
  5820.         char c[sizeof(long)];
  5821.     } u;
  5822.  
  5823.     if (sizeof(long) > 4)
  5824.         u.l = (0x08070605L << 32) | 0x04030201L;
  5825.     else
  5826.         u.l = 0x04030201L;
  5827.     for (i = 0; i < sizeof(long); i++)
  5828.         printf("%c", u.c[i]+'0');
  5829.     printf("\n");
  5830. }
  5831. EOCP
  5832.     if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
  5833.         dflt=`./try`
  5834.         case "$dflt" in
  5835.         ????|????????) echo "(The test program ran ok.)";;
  5836.         *) echo "(The test program didn't run right for some reason.)";;
  5837.         esac
  5838.     else
  5839.         dflt='4321'
  5840.         cat <<'EOM'
  5841. (I can't seem to compile the test program.  Guessing big-endian...)
  5842. EOM
  5843.     fi
  5844.     ;;
  5845. *)
  5846.     echo " "
  5847.     dflt="$byteorder"
  5848.     ;;
  5849. esac
  5850. rp="What is the order of bytes in a long?"
  5851. . ./myread
  5852. byteorder="$ans"
  5853. $rm -f try.c try
  5854.  
  5855. : how do we catenate cpp tokens here?
  5856. echo " "
  5857. echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
  5858. $cat >cpp_stuff.c <<'EOCP'
  5859. #define RCAT(a,b)a/**/b
  5860. #define ACAT(a,b)a ## b
  5861. RCAT(Rei,ser)
  5862. ACAT(Cir,cus)
  5863. EOCP
  5864. $cppstdin $cppflags $cppminus < cpp_stuff.c >cpp_stuff.out 2>&1
  5865. if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
  5866.     echo "Oh!  Smells like ANSI's been here."
  5867.     echo "We can catify or stringify, separately or together!"
  5868.     cpp_stuff=42
  5869. elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
  5870.     echo "Ah, yes!  The good old days!"
  5871.     echo "However, in the good old days we don't know how to stringify and"
  5872.     echo "catify at the same time."
  5873.     cpp_stuff=1
  5874. else
  5875.     $cat >&4 <<EOM
  5876. Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
  5877. to have to edit the values of CAT[2-5] in config.h...
  5878. EOM
  5879.     cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
  5880. fi
  5881.  
  5882. : check for void type
  5883. echo " "
  5884. $cat >&4 <<EOM
  5885. Checking to see how well your C compiler groks the void type...
  5886.  
  5887.   Support flag bits are:
  5888.     1: basic void declarations.
  5889.     2: arrays of pointers to functions returning void.
  5890.     4: operations between pointers to and addresses of void functions.
  5891.     8: generic void pointers.
  5892.  
  5893. EOM
  5894. case "$voidflags" in
  5895. '')
  5896.     $cat >try.c <<'EOCP'
  5897. #if TRY & 1
  5898. void main() {
  5899. #else
  5900. main() {
  5901. #endif
  5902.     extern void moo();    /* function returning void */
  5903.     void (*goo)();        /* ptr to func returning void */
  5904. #if TRY & 8
  5905.     void *hue;        /* generic ptr */
  5906. #endif
  5907. #if TRY & 2
  5908.     void (*foo[10])();
  5909. #endif
  5910.  
  5911. #if TRY & 4
  5912.     if(goo == moo) {
  5913.         exit(0);
  5914.     }
  5915. #endif
  5916.     exit(0);
  5917. }
  5918. EOCP
  5919.     if $cc -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
  5920.         voidflags=$defvoidused
  5921.     echo "It appears to support void to the level $package wants ($defvoidused)."
  5922.         if $contains warning .out >/dev/null 2>&1; then
  5923.             echo "However, you might get some warnings that look like this:"
  5924.             $cat .out
  5925.         fi
  5926.     else
  5927. echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
  5928.         if $cc -c -DTRY=1 try.c >/dev/null 2>&1 ; then
  5929.             echo "It supports 1..."
  5930.             if $cc -c -DTRY=3 try.c >/dev/null 2>&1 ; then
  5931.                 echo "It also supports 2..."
  5932.                 if $cc -c -DTRY=7 try.c >/dev/null 2>&1 ; then
  5933.                     voidflags=7
  5934.                     echo "And it supports 4 but not 8 definitely."
  5935.                 else
  5936.                     echo "It doesn't support 4..."
  5937.                     if $cc -c -DTRY=11 try.c >/dev/null 2>&1 ; then
  5938.                         voidflags=11
  5939.                         echo "But it supports 8."
  5940.                     else
  5941.                         voidflags=3
  5942.                         echo "Neither does it support 8."
  5943.                     fi
  5944.                 fi
  5945.             else
  5946.                 echo "It does not support 2..."
  5947.                 if $cc -c -DTRY=13 try.c >/dev/null 2>&1 ; then
  5948.                     voidflags=13
  5949.                     echo "But it supports 4 and 8."
  5950.                 else
  5951.                     if $cc -c -DTRY=5 try.c >/dev/null 2>&1 ; then
  5952.                         voidflags=5
  5953.                         echo "And it supports 4 but has not heard about 8."
  5954.                     else
  5955.                         echo "However it supports 8 but not 4."
  5956.                     fi
  5957.                 fi
  5958.             fi
  5959.         else
  5960.             echo "There is no support at all for void."
  5961.             voidflags=0
  5962.         fi
  5963.     fi
  5964. esac
  5965. dflt="$voidflags";
  5966. rp="Your void support flags add up to what?"
  5967. . ./myread
  5968. voidflags="$ans"
  5969. $rm -f try.* .out
  5970.  
  5971. : see if this is a db.h system
  5972. set db.h i_db
  5973. eval $inhdr
  5974.  
  5975. : see if we have the old dbm
  5976. set dbm.h i_dbm
  5977. eval $inhdr
  5978.  
  5979. : see if ndbm.h is available
  5980. set ndbm.h i_ndbm
  5981. eval $inhdr
  5982.  
  5983. : see if gdbm.h is available
  5984. set gdbm.h i_gdbm
  5985. eval $inhdr
  5986.  
  5987. echo " "
  5988. echo "Looking for extensions..." >&4
  5989. cd ../ext
  5990. known_extensions=''
  5991. for xxx in * ; do
  5992.     if $test -f $xxx/$xxx.xs; then
  5993.         known_extensions="$known_extensions $xxx"
  5994.     fi
  5995. done
  5996. set X $known_extensions
  5997. shift
  5998. known_extensions="$*"
  5999. cd ../UU
  6000.  
  6001. : Now see which are supported on this system.
  6002. avail_ext=''
  6003. for xxx in $known_extensions ; do
  6004.     case "$xxx" in
  6005.     DB_File) case "$i_db" in 
  6006.         $define) avail_ext="$avail_ext $xxx" ;;
  6007.         esac
  6008.         ;;
  6009.     GDBM_File) case "$i_gdbm" in 
  6010.         $define) avail_ext="$avail_ext $xxx" ;;
  6011.         esac
  6012.         ;;
  6013.     NDBM_File) case "$i_ndbm" in 
  6014.         $define) avail_ext="$avail_ext $xxx" ;;
  6015.         esac
  6016.         ;;
  6017.     ODBM_File) case "$i_dbm" in 
  6018.         $define) avail_ext="$avail_ext $xxx" ;;
  6019.         esac
  6020.         ;;
  6021.     POSIX) case "$useposix" in 
  6022.         true|define|y) avail_ext="$avail_ext $xxx" ;;
  6023.         esac
  6024.         ;;
  6025.     Socket) case "$d_socket" in 
  6026.         $define) avail_ext="$avail_ext $xxx" ;;
  6027.         esac
  6028.         ;;
  6029.     *)      avail_ext="$avail_ext $xxx"
  6030.         ;;
  6031.     esac
  6032. done
  6033.  
  6034. set X $avail_ext
  6035. shift
  6036. avail_ext="$*"
  6037.  
  6038. case $usedl in
  6039. $define)
  6040.     $cat <<EOM
  6041. A number of extensions are supplied with $package.  You may choose to
  6042. compile these extensions for dynamic loading (the default), compile
  6043. them into the $package executable (static loading), or not include
  6044. them at all.  Answer "none" to include no extensions.
  6045.  
  6046. EOM
  6047.     case "$dynamic_ext" in
  6048.     ''|' ') dflt="$avail_ext" ;;
  6049.     *)    dflt="$dynamic_ext" ;;
  6050.     esac
  6051.     case "$dflt" in
  6052.     '')    dflt=none;;
  6053.     esac
  6054.     rp="What extensions do you wish to load dynamically?"
  6055.     . ./myread
  6056.     case "$ans" in
  6057.     none) dynamic_ext='' ;;
  6058.     *) dynamic_ext="$ans" ;;
  6059.     esac
  6060.  
  6061.     case "$static_ext" in
  6062.     ''|' ')
  6063.         : Exclude those already listed in dynamic linking
  6064.         dflt=''
  6065.         for xxx in $avail_ext; do
  6066.             case " $dynamic_ext " in
  6067.             *" $xxx "*) ;;
  6068.             *) dflt="$dflt $xxx" ;;
  6069.             esac
  6070.         done
  6071.         set X $dflt
  6072.         shift
  6073.         dflt="$*"
  6074.         ;;
  6075.     *)  dflt="$static_ext" 
  6076.         ;;
  6077.     esac
  6078.  
  6079.     case "$dflt" in
  6080.     '')    dflt=none;;
  6081.     esac
  6082.     rp="What extensions do you wish to load statically?"
  6083.     . ./myread
  6084.     case "$ans" in
  6085.     none) static_ext='' ;;
  6086.     *) static_ext="$ans" ;;
  6087.     esac
  6088.     ;;
  6089. *)
  6090.     $cat <<EOM
  6091. A number of extensions are supplied with $package.  Answer "none" 
  6092. to include no extensions. 
  6093.  
  6094. EOM
  6095.     case "$static_ext" in
  6096.     ''|' ') dflt="$avail_ext" ;;
  6097.     *)    dflt="$static_ext" ;;
  6098.     esac
  6099.  
  6100.     case "$dflt" in
  6101.     '')    dflt=none;;
  6102.     esac
  6103.     rp="What extensions do you wish to include?"
  6104.     . ./myread
  6105.     case "$ans" in
  6106.     none) static_ext='' ;;
  6107.     *) static_ext="$ans" ;;
  6108.     esac
  6109.     ;;
  6110. esac
  6111.  
  6112. set X $dynamic_ext $static_ext
  6113. shift
  6114. extensions="$*"
  6115.  
  6116. : see what type file positions are declared as in the library
  6117. set fpos_t fpostype long stdio.h sys/types.h
  6118. eval $typedef
  6119. echo " "
  6120. dflt="$fpostype"
  6121. rp="What is the type for file position used by fsetpos()?"
  6122. . ./myread
  6123. fpostype="$ans"
  6124.  
  6125. : see what type gids are declared as in the kernel
  6126. set gid_t gidtype xxx stdio.h sys/types.h
  6127. eval $typedef
  6128. case "$gidtype" in
  6129. xxx)
  6130.     xxx=`./findhdr sys/user.h`
  6131.     set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
  6132.     case $1 in
  6133.     unsigned) dflt="$1 $2" ;;
  6134.     *) dflt="$1" ;;
  6135.     esac
  6136.     ;;
  6137. *) dflt="$gidtype";;
  6138. esac
  6139. echo " "
  6140. rp="What is the type for group ids returned by getgid()?"
  6141. . ./myread
  6142. gidtype="$ans"
  6143.  
  6144. : see if getgroups exists
  6145. set getgroups d_getgrps
  6146. eval $inlibc
  6147.  
  6148. : Find type of 2nd arg to getgroups
  6149. echo " "
  6150. case "$d_getgrps" in
  6151. 'define')
  6152.     case "$groupstype" in
  6153.     '') dflt="$gidtype" ;;
  6154.     *)  dflt="$groupstype" ;;
  6155.     esac
  6156.     $cat <<EOM
  6157. What is the type of the second argument to getgroups()?  Usually this
  6158. is the same as group ids, $gidtype, but not always.
  6159.  
  6160. EOM
  6161.     rp='What type is the second argument to getgroups()?'
  6162.     . ./myread
  6163.     groupstype="$ans"
  6164.     ;;
  6165. *)  groupstype="$gidtype";;
  6166. esac
  6167.  
  6168. : see what type lseek is declared as in the kernel
  6169. set off_t lseektype long stdio.h sys/types.h
  6170. eval $typedef
  6171. echo " "
  6172. dflt="$lseektype"
  6173. rp="What type is lseek's offset on this system declared as?"
  6174. . ./myread
  6175. lseektype="$ans"
  6176.  
  6177. : determine where manual pages go
  6178. $cat <<EOM
  6179.  
  6180. $package has manual pages available in source form.
  6181. EOM
  6182. case "$_nroff" in
  6183. nroff)
  6184.     echo "However, you don't have nroff, so they're probably useless to you."
  6185.     case "$mansrc" in
  6186.     '') mansrc="none";;
  6187.     esac;;
  6188. esac
  6189. echo "If you don't want the manual sources installed, answer 'none'."
  6190. case "$mansrc" in
  6191. '')
  6192.     lookpath="$prefix/man/man1 $prefix/man/u_man/man1 $prefix/man/l_man/man1"
  6193.     lookpath="$lookpath /usr/local/man/man1 /usr/local/man/man1 /usr/man/manl"
  6194.     lookpath="$lookpath /usr/man/local/man1 /usr/man/l_man/man1"
  6195.     lookpath="$lookpath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
  6196.     lookpath="$lookpath /usr/man/man.L"
  6197.     mansrc=`./loc . $prefix/man/man1 $lookpath`
  6198.     if $test -d "$mansrc"; then
  6199.         dflt="$mansrc"
  6200.     else
  6201.         dflt="$sysman"
  6202.     fi
  6203.     ;;
  6204. *)  dflt="$mansrc"
  6205.     ;;
  6206. esac
  6207. echo " "
  6208. fn=dn~
  6209. rp='Where do the manual pages (source) go?'
  6210. . ./getfile
  6211. mansrc="$ans"
  6212. mansrcexp="$ansexp"
  6213. if $afs; then
  6214.     $cat <<EOM
  6215.  
  6216. Since you are running AFS, I need to distinguish the directory in which
  6217. manual pages reside from the directory in which they are installed (and from
  6218. which they are presumably copied to the former directory by occult means).
  6219.  
  6220. EOM
  6221.     case "$installmansrc" in
  6222.     '') dflt=`echo $mansrcexp | sed 's#^/afs/#/afs/.#'`;;
  6223.     *) dflt="$installmansrc";;
  6224.     esac
  6225.     fn=de~
  6226.     rp='Where will man pages be installed?'
  6227.     . ./getfile
  6228.     installmansrc="$ans"
  6229. else
  6230.     installmansrc="$mansrcexp"
  6231. fi
  6232.  
  6233.  
  6234. case "$mansrc" in
  6235. '') manext='0';;
  6236. *l) manext=l;;
  6237. *n) manext=n;;
  6238. *o) manext=l;;
  6239. *p) manext=n;;
  6240. *C) manext=C;;
  6241. *L) manext=L;;
  6242. *L1) manext=L1;;
  6243. *) manext=1;;
  6244. esac
  6245.  
  6246. : see what type is used for mode_t
  6247. set mode_t modetype int stdio.h sys/types.h
  6248. eval $typedef
  6249. dflt="$modetype"
  6250. echo " "
  6251. rp="What type is used for file modes?"
  6252. . ./myread
  6253. modetype="$ans"
  6254.  
  6255. : Cruising for prototypes
  6256. echo " "
  6257. echo "Checking out function prototypes..." >&4
  6258. $cat >prototype.c <<'EOCP'
  6259. main(int argc, char *argv[]) {
  6260.     exit(0);}
  6261. EOCP
  6262. if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
  6263.     echo "Your C compiler appears to support function prototypes."
  6264.     val="$define"
  6265. else
  6266.     echo "Your C compiler doesn't seem to understand function prototypes."
  6267.     val="$undef"
  6268. fi
  6269. set prototype
  6270. eval $setvar
  6271. $rm -f prototype*
  6272.  
  6273. : check for size of random number generator
  6274. echo " "
  6275. case "$randbits" in
  6276. '')
  6277.     echo "Checking to see how many bits your rand function produces..." >&4
  6278.     $cat >try.c <<'EOCP'
  6279. #include <stdio.h>
  6280. main()
  6281. {
  6282.     register int i;
  6283.     register unsigned long tmp;
  6284.     register unsigned long max = 0L;
  6285.  
  6286.     for (i = 1000; i; i--) {
  6287.         tmp = (unsigned long)rand();
  6288.         if (tmp > max) max = tmp;
  6289.     }
  6290.     for (i = 0; max; i++)
  6291.         max /= 2;
  6292.     printf("%d\n",i);
  6293. }
  6294. EOCP
  6295.     if $cc try.c -o try >/dev/null 2>&1 ; then
  6296.         dflt=`try`
  6297.     else
  6298.         dflt='?'
  6299.         echo "(I can't seem to compile the test program...)"
  6300.     fi
  6301.     ;;
  6302. *)
  6303.     dflt="$randbits"
  6304.     ;;
  6305. esac
  6306. rp='How many bits does your rand() function produce?'
  6307. . ./myread
  6308. randbits="$ans"
  6309. $rm -f try.c try
  6310.  
  6311. : see if ar generates random libraries by itself
  6312. echo " "
  6313. echo "Checking how to generate random libraries on your machine..." >&4
  6314. echo 'int bar1() { return bar2(); }' > bar1.c
  6315. echo 'int bar2() { return 2; }' > bar2.c
  6316. $cat > foo.c <<'EOP'
  6317. main() { printf("%d\n", bar1()); exit(0); }
  6318. EOP
  6319. $cc $ccflags -c bar1.c >/dev/null 2>&1
  6320. $cc $ccflags -c bar2.c >/dev/null 2>&1
  6321. $cc $ccflags -c foo.c >/dev/null 2>&1
  6322. ar rc bar.a bar2.o bar1.o >/dev/null 2>&1
  6323. if $cc $ccflags $ldflags -o foobar foo.o bar.a $libs > /dev/null 2>&1 &&
  6324.     ./foobar >/dev/null 2>&1; then
  6325.     echo "ar appears to generate random libraries itself."
  6326.     orderlib=false
  6327.     ranlib=":"
  6328. elif ar ts bar.a >/dev/null 2>&1 &&
  6329.     $cc $ccflags $ldflags -o foobar foo.o bar.a $libs > /dev/null 2>&1 &&
  6330.     ./foobar >/dev/null 2>&1; then
  6331.         echo "a table of contents needs to be added with 'ar ts'."
  6332.         orderlib=false
  6333.         ranlib="ar ts"
  6334. else
  6335.     if $test -f /usr/bin/ranlib; then
  6336.         ranlib=/usr/bin/ranlib
  6337.     elif $test -f /bin/ranlib; then
  6338.         ranlib=/bin/ranlib
  6339.     elif $test -f /usr/local/bin/ranlib; then
  6340.         ranlib=/usr/local/bin/ranlib
  6341.     fi
  6342.  
  6343.     if $test -n "$ranlib"; then
  6344.         echo "your system has $ranlib; we'll use that."
  6345.         orderlib=false
  6346.     else
  6347.         echo "your system doesn't seem to support random libraries"
  6348.         echo "so we'll use lorder and tsort to order the libraries."
  6349.         orderlib=true
  6350.         ranlib=":"
  6351.     fi
  6352. fi
  6353. $rm -f foo* bar* 
  6354.  
  6355. : determine where public executable scripts go
  6356. case "$scriptdir" in
  6357. '')
  6358.     dflt="$bin"
  6359.     : guess some guesses
  6360.     $test -d /usr/share/scripts && dflt=/usr/share/scripts
  6361.     $test -d /usr/share/bin && dflt=/usr/share/bin
  6362.     $test -d /usr/local/script && dflt=/usr/local/script
  6363.     $test -d $prefix/script && dflt=$prefix/script
  6364.     ;;
  6365. *)  dflt="$scriptdir"
  6366.     ;;
  6367. esac
  6368. $cat <<EOM
  6369.  
  6370. Some installations have a separate directory just for executable scripts so
  6371. that they can mount it across multiple architectures but keep the scripts in
  6372. one spot.  You might, for example, have a subdirectory of /usr/share for this.
  6373. Or you might just lump your scripts in with all your other executables.
  6374.  
  6375. EOM
  6376. fn=d~
  6377. rp='Where do you keep publicly executable scripts?'
  6378. . ./getfile
  6379. scriptdir="$ans"
  6380. scriptdirexp="$ansexp"
  6381. if $afs; then
  6382.     $cat <<EOM
  6383.  
  6384. Since you are running AFS, I need to distinguish the directory in which
  6385. scripts reside from the directory in which they are installed (and from
  6386. which they are presumably copied to the former directory by occult means).
  6387.  
  6388. EOM
  6389.     case "$installscript" in
  6390.     '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;;
  6391.     *) dflt="$installscript";;
  6392.     esac
  6393.     fn=de~
  6394.     rp='Where will public scripts be installed?'
  6395.     . ./getfile
  6396.     installscript="$ans"
  6397. else
  6398.     installscript="$scriptdirexp"
  6399. fi
  6400.  
  6401. : see if sys/select.h has to be included
  6402. set sys/select.h i_sysselct
  6403. eval $inhdr
  6404.  
  6405. : see if we should include time.h, sys/time.h, or both
  6406. echo " "
  6407. echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
  6408. $echo $n "I'm now running the test program...$c"
  6409. $cat >try.c <<'EOCP'
  6410. #include <sys/types.h>
  6411. #ifdef I_TIME
  6412. #include <time.h>
  6413. #endif
  6414. #ifdef I_SYSTIME
  6415. #ifdef SYSTIMEKERNEL
  6416. #define KERNEL
  6417. #endif
  6418. #include <sys/time.h>
  6419. #endif
  6420. #ifdef I_SYSSELECT
  6421. #include <sys/select.h>
  6422. #endif
  6423. main()
  6424. {
  6425.     struct tm foo;
  6426. #ifdef S_TIMEVAL
  6427.     struct timeval bar;
  6428. #endif
  6429. #ifdef S_TIMEZONE
  6430.     struct timezone tzp;
  6431. #endif
  6432.     if (foo.tm_sec == foo.tm_sec)
  6433.         exit(0);
  6434. #ifdef S_TIMEVAL
  6435.     if (bar.tv_sec == bar.tv_sec)
  6436.         exit(0);
  6437. #endif
  6438.     exit(1);
  6439. }
  6440. EOCP
  6441. flags=''
  6442. s_timezone=''
  6443. sysselect=''
  6444. for s_timeval in '-DS_TIMEVAL' ''; do
  6445. for i_systimek in '' '-DSYSTIMEKERNEL'; do
  6446. for i_time in '' '-DI_TIME'; do
  6447. for i_systime in '-DI_SYSTIME' ''; do
  6448.     case "$flags" in
  6449.     '') $echo $n ".$c"
  6450.         if $cc $ccflags \
  6451.         $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone \
  6452.         try.c -o try >/dev/null 2>&1 ; then
  6453.             set X $i_time $i_systime $i_systimek $sysselect $s_timeval
  6454.             shift
  6455.             flags="$*"
  6456.             echo " "
  6457.             $echo $n "Succeeded with $flags$c"
  6458.         fi
  6459.         ;;
  6460.     esac
  6461. done
  6462. done
  6463. done
  6464. done
  6465. timeincl=''
  6466. echo " "
  6467. case "$flags" in
  6468. *SYSTIMEKERNEL*) i_systimek="$define"
  6469.     timeincl=`./findhdr sys/time.h`
  6470.     echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
  6471. *) i_systimek="$undef";;
  6472. esac
  6473. case "$flags" in
  6474. *I_TIME*) i_time="$define"
  6475.     timeincl=`./findhdr time.h`" $timeincl"
  6476.     echo "We'll include <time.h>." >&4;;
  6477. *) i_time="$undef";;
  6478. esac
  6479. case "$flags" in
  6480. *I_SYSTIME*) i_systime="$define"
  6481.     timeincl=`./findhdr sys/time.h`" $timeincl"
  6482.     echo "We'll include <sys/time.h>." >&4;;
  6483. *) i_systime="$undef";;
  6484. esac
  6485. $rm -f try.c try
  6486.  
  6487. : check for fd_set items
  6488. $cat <<EOM
  6489.  
  6490. Checking to see how well your C compiler handles fd_set and friends ...
  6491. EOM
  6492. $cat >fd_set.c <<EOCP
  6493. #$i_systime I_SYS_TIME
  6494. #$i_sysselct I_SYS_SELECT
  6495. #$d_socket HAS_SOCKET
  6496. #include <sys/types.h>
  6497. #ifdef HAS_SOCKET
  6498. #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
  6499. #endif
  6500. #ifdef I_SYS_TIME
  6501. #include <sys/time.h>
  6502. #else
  6503. #ifdef I_SYS_SELECT
  6504. #include <sys/select.h>
  6505. #endif
  6506. #endif
  6507. main() {
  6508.     fd_set fds;
  6509.  
  6510. #ifdef TRYBITS
  6511.     if(fds.fds_bits);
  6512. #endif
  6513.  
  6514. #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
  6515.     exit(0);
  6516. #else
  6517.     exit(1);
  6518. #endif
  6519. }
  6520. EOCP
  6521. if $cc $ccflags -DTRYBITS fd_set.c -o fd_set >fd_set.out 2>&1 ; then
  6522.     d_fds_bits="$define"
  6523.     d_fd_set="$define"
  6524.     echo "Well, your system knows about the normal fd_set typedef..." >&4
  6525.     if ./fd_set; then
  6526.         echo "and you have the normal fd_set macros (just as I'd expect)." >&4
  6527.         d_fd_macros="$define"
  6528.     else
  6529.         $cat >&4 <<'EOM'
  6530. but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
  6531. EOM
  6532.         d_fd_macros="$undef"
  6533.     fi
  6534. else
  6535.     $cat <<'EOM'
  6536. Hmm, your compiler has some difficulty with fd_set.  Checking further...
  6537. EOM
  6538.     if $cc $ccflags fd_set.c -o fd_set >fd_set.out 2>&1 ; then
  6539.         d_fds_bits="$undef"
  6540.         d_fd_set="$define"
  6541.         echo "Well, your system has some sort of fd_set available..." >&4
  6542.         if ./fd_set; then
  6543.             echo "and you have the normal fd_set macros." >&4
  6544.             d_fd_macros="$define"
  6545.         else
  6546.             $cat <<'EOM'
  6547. but not the normal fd_set macros!  Gross!  More work for me...
  6548. EOM
  6549.             d_fd_macros="$undef"
  6550.         fi
  6551.     else
  6552.     echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
  6553.         d_fd_set="$undef"
  6554.         d_fds_bits="$undef"
  6555.         d_fd_macros="$undef"
  6556.     fi
  6557. fi
  6558. $rm -f fd_set*
  6559.  
  6560.  
  6561. : check for type of arguments to select.  This will only really
  6562. : work if the system supports prototypes and provides one for
  6563. : select.
  6564. case "$d_select" in
  6565. $define)
  6566.     : Make initial guess
  6567.     case "$selecttype" in
  6568.     ''|' ')
  6569.         case "$d_fd_set" in
  6570.         $define) xxx='fd_set *' ;;
  6571.         *) xxx='int *' ;;
  6572.         esac
  6573.         ;;
  6574.     *)     xxx="$selecttype" 
  6575.         ;;
  6576.     esac
  6577.     : backup guess
  6578.     case "$xxx" in
  6579.     'fd_set *') yyy='int *' ;;
  6580.     'int *') yyy='fd_set *' ;;
  6581.     esac
  6582.  
  6583.     $cat <<EOM
  6584.  
  6585. Checking to see what type of arguments are expected by select().
  6586. EOM
  6587.     $cat >try.c <<EOCP
  6588. #$i_systime I_SYS_TIME
  6589. #$i_sysselct I_SYS_SELECT
  6590. #$d_socket HAS_SOCKET
  6591. #include <sys/types.h>
  6592. #ifdef HAS_SOCKET
  6593. #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
  6594. #endif
  6595. #ifdef I_SYS_TIME
  6596. #include <sys/time.h>
  6597. #else
  6598. #ifdef I_SYS_SELECT
  6599. #include <sys/select.h>
  6600. #endif
  6601. #endif
  6602. main()
  6603. {
  6604.     int width;
  6605.     Select_fd_set_t readfds;
  6606.     Select_fd_set_t writefds;
  6607.     Select_fd_set_t exceptfds;
  6608.     struct timeval timeout;
  6609.     select(width, readfds, writefds, exceptfds, &timeout);
  6610.     exit(0);
  6611. }
  6612. EOCP
  6613.     if $cc $ccflags -c -DSelect_fd_set_t="$xxx" try.c >/dev/null 2>&1 ; then
  6614.         selecttype="$xxx"
  6615.         echo "Your system uses $xxx for the arguments to select." >&4
  6616.     elif $cc $ccflags -c -DSelect_fd_set_t="$yyy" try.c >/dev/null 2>&1 ; then
  6617.         selecttype="$yyy"
  6618.         echo "Your system uses $yyy for the arguments to select." >&4
  6619.     else
  6620.         rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
  6621.         dflt="$xxx"
  6622.         . ./myread
  6623.         selecttype="$ans"
  6624.     fi
  6625.     $rm -f try.[co]
  6626.     ;;
  6627. *)    selecttype = 'int *' 
  6628.     ;;
  6629. esac
  6630.  
  6631. : generate list of signal names
  6632. echo " "
  6633. case "$sig_name" in
  6634. '')
  6635.     echo "Generating a list of signal names..." >&4
  6636.     xxx=`./findhdr signal.h`" "`./findhdr sys/signal.h`
  6637.     set X `cat $xxx 2>&1 | $awk '
  6638. $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ {
  6639.     sig[$3] = substr($2,4,20)
  6640.     if (max < $3 && $3 < 60) {
  6641.         max = $3
  6642.     }
  6643. }
  6644.  
  6645. END {
  6646.     for (i = 1; i <= max; i++) {
  6647.         if (sig[i] == "")
  6648.             printf "%d", i
  6649.         else
  6650.             printf "%s", sig[i]
  6651.         if (i < max)
  6652.             printf " "
  6653.     }
  6654.     printf "\n"
  6655. }
  6656. '`
  6657.     shift
  6658.     case $# in
  6659.     0)
  6660.         echo 'kill -l' >/tmp/foo$$
  6661.         set X `csh -f </tmp/foo$$`
  6662.         $rm -f /tmp/foo$$
  6663.         shift
  6664.         case $# in
  6665.         0)set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM
  6666.         ;;
  6667.         esac
  6668.         ;;
  6669.     esac
  6670.     sig_name="ZERO $*"
  6671.     ;;
  6672. esac
  6673. echo "The following signals are available:"
  6674. echo " "
  6675. echo $sig_name | $awk \
  6676. 'BEGIN { linelen = 0 }
  6677. {
  6678.     for (i = 1; i < NF; i++) {
  6679.         name = "SIG" $i " "
  6680.         linelen = linelen + length(name)
  6681.         if (linelen > 70) {
  6682.             printf "\n"
  6683.             linelen = length(name)
  6684.         }
  6685.         printf "%s", name
  6686.     }
  6687. }'
  6688. echo " "
  6689.  
  6690. : see what type is used for size_t
  6691. set size_t sizetype 'unsigned int' stdio.h sys/types.h
  6692. eval $typedef
  6693. dflt="$sizetype"
  6694. echo " "
  6695. rp="What type is used for the length parameter for string functions?"
  6696. . ./myread
  6697. sizetype="$ans"
  6698.  
  6699. : see what type is used for signed size_t
  6700. set ssize_t ssizetype int stdio.h sys/types.h
  6701. eval $typedef
  6702. dflt="$ssizetype"
  6703. $cat > ssize.c <<EOM
  6704. #include <stdio.h>
  6705. #include <sys/types.h>
  6706. #define Size_t $sizetype
  6707. #define SSize_t $dflt
  6708. main()
  6709. {
  6710.     if (sizeof(Size_t) == sizeof(SSize_t))
  6711.         printf("$dflt\n");
  6712.     else if (sizeof(Size_t) == sizeof(int))
  6713.         printf("int\n");
  6714.     else 
  6715.         printf("long\n");
  6716. }
  6717. EOM
  6718. echo " "
  6719. if $cc $ccflags $ldflags -o ssize ssize.c $libs > /dev/null 2>&1 ; then
  6720.     ssizetype=`./ssize`
  6721.     echo "I'll be using $ssizetype for functions returning a byte count." >&4
  6722. else
  6723.     echo "(I can't compile the test program--please enlighten me!)"
  6724.     $cat <<EOM
  6725.  
  6726. I need a type that is the same size as $sizetype, but is guaranteed to
  6727. be signed.  Common values are int and long.
  6728.  
  6729. EOM
  6730.     rp="What signed type is the same size as $sizetype?"
  6731.     . ./myread
  6732.     ssizetype="$ans"
  6733. fi
  6734. $rm -f ssize ssize.[co]
  6735.  
  6736. : see what type of char stdio uses.
  6737. echo " "
  6738. if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
  6739.     echo "Your stdio uses unsigned chars." >&4
  6740.     stdchar="unsigned char"
  6741. else
  6742.     echo "Your stdio uses signed chars." >&4
  6743.     stdchar="char"
  6744. fi
  6745.  
  6746. : see if time exists
  6747. echo " "
  6748. if set time tval -f d_time; eval $csym; $tval; then
  6749.     echo 'time() found.' >&4
  6750.     tval="$define"
  6751.     set time_t timetype long stdio.h sys/types.h
  6752.     eval $typedef
  6753.     dflt="$timetype"
  6754.     echo " "
  6755.     rp="What type is returned by time() on this sytem?"
  6756.     . ./myread
  6757.     timetype="$ans"
  6758. else
  6759.     echo 'time() not found, hope that will do.' >&4
  6760.     tval="$undef"
  6761.     timetype='int';
  6762. fi
  6763. val=$tval
  6764. set d_time
  6765. eval $setvar
  6766.  
  6767. : see what type uids are declared as in the kernel
  6768. set uid_t uidtype xxx stdio.h sys/types.h
  6769. eval $typedef
  6770. case "$uidtype" in
  6771. xxx)
  6772.     xxx=`./findhdr sys/user.h`
  6773.     set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
  6774.     case $1 in
  6775.     unsigned) dflt="$1 $2" ;;
  6776.     *) dflt="$1" ;;
  6777.     esac
  6778.     ;;
  6779. *) dflt="$uidtype";;
  6780. esac
  6781. echo " "
  6782. rp="What is the type for user ids returned by getuid()?"
  6783. . ./myread
  6784. uidtype="$ans"
  6785.  
  6786. : determine compiler compiler
  6787. case "$yacc" in
  6788. '')
  6789.     dflt=yacc;;
  6790. *)
  6791.     dflt="$yacc";;
  6792. esac
  6793. echo " "
  6794. comp='yacc'
  6795. if $test -f "$byacc"; then
  6796.     dflt="$byacc"
  6797.     comp="byacc or $comp"
  6798. fi
  6799. if $test -f "$bison"; then
  6800.     comp="$comp or bison -y"
  6801. fi
  6802. rp="Which compiler compiler ($comp) shall I use?"
  6803. . ./myread
  6804. yacc="$ans"
  6805. case "$yacc" in
  6806. *bis*)
  6807.     case "$yacc" in
  6808.     *-y*) ;;
  6809.     *)
  6810.         yacc="$yacc -y"
  6811.         echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
  6812.         ;;
  6813.     esac
  6814.     ;;
  6815. esac
  6816.  
  6817. : see if this is a sys/file.h system
  6818. val=''
  6819. set sys/file.h val
  6820. eval $inhdr
  6821.  
  6822. : do we need to #include <sys/file.h> ?
  6823. case "$val" in
  6824. "$define")
  6825.     echo " "
  6826.     if $h_sysfile; then
  6827.         val="$define"
  6828.         echo "We'll be including <sys/file.h>." >&4
  6829.     else
  6830.         val="$undef"
  6831.         echo "We won't be including <sys/file.h>." >&4
  6832.     fi
  6833.     ;;
  6834. *)
  6835.     h_sysfile=false
  6836.     ;;
  6837. esac
  6838. set i_sysfile
  6839. eval $setvar
  6840.  
  6841. : see if fcntl.h is there
  6842. val=''
  6843. set fcntl.h val
  6844. eval $inhdr
  6845.  
  6846. : see if we can include fcntl.h
  6847. case "$val" in
  6848. "$define")
  6849.     echo " "
  6850.     if $h_fcntl; then
  6851.         val="$define"
  6852.         echo "We'll be including <fcntl.h>." >&4
  6853.     else
  6854.         val="$undef"
  6855.         if $h_sysfile; then
  6856.     echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
  6857.         else
  6858.             echo "We won't be including <fcntl.h>." >&4
  6859.         fi
  6860.     fi
  6861.     ;;
  6862. *)
  6863.     h_fcntl=false
  6864.     val="$undef"
  6865.     ;;
  6866. esac
  6867. set i_fcntl
  6868. eval $setvar
  6869.  
  6870. : see if this is an grp system
  6871. set grp.h i_grp
  6872. eval $inhdr
  6873.  
  6874. : see if this is a math.h system
  6875. set math.h i_math
  6876. eval $inhdr
  6877.  
  6878. : see if memory.h is available.
  6879. val=''
  6880. set memory.h val
  6881. eval $inhdr
  6882.  
  6883. : See if it conflicts with string.h
  6884. case "$val" in
  6885. $define)
  6886.     case "$strings" in
  6887.     '') ;;
  6888.     *)
  6889.         $cppstdin $cppflags $cppminus < $strings > mem.h
  6890.         if $contains 'memcpy' mem.h >/dev/null 2>&1; then
  6891.             echo " "
  6892.             echo "We won't be including <memory.h>."
  6893.             val="$undef"
  6894.         fi
  6895.         $rm -f mem.h
  6896.         ;;
  6897.     esac
  6898. esac
  6899. set i_memory
  6900. eval $setvar
  6901.  
  6902. : see if net/errno.h is available
  6903. val=''
  6904. set net/errno.h val
  6905. eval $inhdr
  6906.  
  6907. : Unfortunately, it causes problems on some systems.  Arrgh.
  6908. case "$val" in
  6909. $define)
  6910.     cat > try.c <<'EOM'
  6911. #include <stdio.h>
  6912. #include <errno.h>
  6913. #include <net/errno.h>
  6914. int func()
  6915. {
  6916.     return ENOTSOCK;
  6917. }
  6918. EOM
  6919.     if $cc $ccflags -c try.c >/dev/null 2>&1; then
  6920.         echo "We'll be including <net/errno.h>." >&4
  6921.     else
  6922.         echo "We won't be including <net/errno.h>." >&4
  6923.         val="$undef"
  6924.     fi
  6925.     $rm -f try.* try
  6926.     ;;
  6927. esac
  6928. set i_neterrno
  6929. eval $setvar
  6930.  
  6931. : get C preprocessor symbols handy
  6932. echo " "
  6933. echo $al | $tr ' ' '\012' >Cppsym.know
  6934. $cat <<EOSS >Cppsym
  6935. $startsh
  6936. case "\$1" in
  6937. -l) list=true
  6938.     shift
  6939.     ;;
  6940. esac
  6941. unknown=''
  6942. case "\$list\$#" in
  6943. 1|2)
  6944.     for sym do
  6945.         if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
  6946.             exit 0
  6947.         elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
  6948.             :
  6949.         else
  6950.             unknown="\$unknown \$sym"
  6951.         fi
  6952.     done
  6953.     set X \$unknown
  6954.     shift
  6955.     ;;
  6956. esac
  6957. case \$# in
  6958. 0) exit 1;;
  6959. esac
  6960. echo \$* | $tr ' ' '\012' | $sed -e 's/\(.*\)/\\
  6961. #ifdef \1\\
  6962. exit 0; _ _ _ _\1\\     \1\\
  6963. #endif\\
  6964. /' >Cppsym\$\$
  6965. echo "exit 1; _ _ _" >>Cppsym\$\$
  6966. $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
  6967. case "\$list" in
  6968. true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
  6969. *)
  6970.     sh Cppsym2\$\$
  6971.     status=\$?
  6972.     ;;
  6973. esac
  6974. $rm -f Cppsym\$\$ Cppsym2\$\$
  6975. exit \$status
  6976. EOSS
  6977. chmod +x Cppsym
  6978. $eunicefix Cppsym
  6979. echo "Your C preprocessor defines the following symbols:"
  6980. Cppsym -l $al >Cppsym.true
  6981. $cat Cppsym.true
  6982.  
  6983. : see if this is a termio system
  6984. val="$undef"
  6985. val2="$undef"
  6986. val3="$undef"
  6987. if $test `./findhdr termios.h`; then
  6988.     set tcsetattr i_termios
  6989.     eval $inlibc
  6990.     val3="$i_termios"
  6991. fi
  6992. echo " "
  6993. case "$val3" in
  6994. "$define") echo "You have POSIX termios.h... good!" >&4;;
  6995. *) if Cppsym pyr; then
  6996.         case "`/bin/universe`" in
  6997.         ucb) if $test `./findhdr sgtty.h`; then
  6998.                 val2="$define"
  6999.                 echo "<sgtty.h> found." >&4
  7000.             else
  7001.                 echo "System is pyramid with BSD universe."
  7002.                 echo "<sgtty.h> not found--you could have problems." >&4
  7003.             fi;;
  7004.         *) if $test `./findhdr termio.h`; then
  7005.                 val="$define"
  7006.                 echo "<termio.h> found." >&4
  7007.             else
  7008.                 echo "System is pyramid with USG universe."
  7009.                 echo "<termio.h> not found--you could have problems." >&4
  7010.             fi;;
  7011.         esac
  7012.     elif usg; then
  7013.         if $test `./findhdr termio.h`; then
  7014.             echo "<termio.h> found." >&4
  7015.             val="$define"
  7016.         elif $test `./findhdr sgtty.h`; then
  7017.             echo "<sgtty.h> found." >&4
  7018.             val2="$define"
  7019.         else
  7020. echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
  7021.         fi
  7022.     else
  7023.         if $test `./findhdr sgtty.h`; then
  7024.             echo "<sgtty.h> found." >&4
  7025.             val2="$define"
  7026.         elif $test `./findhdr termio.h`; then
  7027.             echo "<termio.h> found." >&4
  7028.             val="$define"
  7029.         else
  7030. echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
  7031.         fi
  7032.     fi;;
  7033. esac
  7034. set i_termio; eval $setvar
  7035. val=$val2; set i_sgtty; eval $setvar
  7036. val=$val3; set i_termios; eval $setvar
  7037.  
  7038. : see if stdarg is available
  7039. echo " "
  7040. if $test `./findhdr stdarg.h`; then
  7041.     echo "<stdarg.h> found." >&4
  7042.     valstd="$define"
  7043. else
  7044.     echo "<stdarg.h> NOT found." >&4
  7045.     valstd="$undef"
  7046. fi
  7047.  
  7048. : see if varags is available
  7049. echo " "
  7050. if $test `./findhdr varargs.h`; then
  7051.     echo "<varargs.h> found." >&4
  7052. else
  7053.     echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
  7054. fi
  7055.  
  7056. : set up the varargs testing programs
  7057. $cat > varargs.c <<EOP
  7058. #ifdef I_STDARG
  7059. #include <stdarg.h>
  7060. #endif
  7061. #ifdef I_VARARGS
  7062. #include <varargs.h>
  7063. #endif
  7064.  
  7065. #ifdef I_STDARG
  7066. int f(char *p, ...)
  7067. #else
  7068. int f(va_alist)
  7069. va_dcl
  7070. #endif
  7071. {
  7072.     va_list ap;
  7073. #ifndef I_STDARG
  7074.     char *p;
  7075. #endif
  7076. #ifdef I_STDARG
  7077.     va_start(ap,p);
  7078. #else
  7079.     va_start(ap);
  7080.     p = va_arg(ap, char *);
  7081. #endif
  7082.     va_end(ap);
  7083. }
  7084. EOP
  7085. $cat > varargs <<EOP
  7086. if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
  7087.     echo "true"
  7088. else
  7089.     echo "false"
  7090. fi
  7091. $rm -f varargs.o
  7092. EOP
  7093. chmod +x varargs
  7094.  
  7095. : now check which varargs header should be included
  7096. echo " "
  7097. i_varhdr=''
  7098. case "$valstd" in
  7099. "$define")
  7100.     if `./varargs I_STDARG`; then
  7101.         val='stdarg.h'
  7102.     elif `./varargs I_VARARGS`; then
  7103.         val='varargs.h'
  7104.     fi
  7105.     ;;
  7106. *)
  7107.     if `./varargs I_VARARGS`; then
  7108.         val='varargs.h'
  7109.     fi
  7110.     ;;
  7111. esac
  7112. case "$val" in
  7113. '')
  7114. echo "I could not find the definition for va_dcl... You have problems..." >&4
  7115.     val="$undef"; set i_stdarg; eval $setvar
  7116.     val="$undef"; set i_varargs; eval $setvar
  7117.     ;;
  7118. *) 
  7119.     set i_varhdr
  7120.     eval $setvar
  7121.     case "$i_varhdr" in
  7122.     stdarg.h)
  7123.         val="$define"; set i_stdarg; eval $setvar
  7124.         val="$undef"; set i_varargs; eval $setvar
  7125.         ;;
  7126.     varargs.h)
  7127.         val="$undef"; set i_stdarg; eval $setvar
  7128.         val="$define"; set i_varargs; eval $setvar
  7129.         ;;
  7130.     esac
  7131.     echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
  7132. esac
  7133. $rm -f varargs*
  7134.  
  7135. : see if stddef is available
  7136. set stddef.h i_stddef
  7137. eval $inhdr
  7138.  
  7139. : see if stdlib is available
  7140. set stdlib.h i_stdlib
  7141. eval $inhdr
  7142.  
  7143. : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
  7144. set sys/filio.h i_sysfilio
  7145. eval $inhdr
  7146. echo " "
  7147. if $test `./findhdr sys/ioctl.h`; then
  7148.     val="$define"
  7149.     echo '<sys/ioctl.h> found.' >&4
  7150. else
  7151.     val="$undef"
  7152.     if $test $i_sysfilio = "$define"; then
  7153.         echo '<sys/ioctl.h> NOT found.' >&4
  7154.     else
  7155.         $test $i_sgtty = "$define" && xxx="sgtty.h"
  7156.         $test $i_termio = "$define" && xxx="termio.h"
  7157.         $test $i_termios = "$define" && xxx="termios.h"
  7158. echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
  7159.     fi
  7160. fi
  7161. set i_sysioctl
  7162. eval $setvar
  7163.  
  7164. : see if this is a sys/param system
  7165. set sys/param.h i_sysparam
  7166. eval $inhdr
  7167.  
  7168. : see if this is a unistd.h system
  7169. set unistd.h i_unistd
  7170. eval $inhdr
  7171.  
  7172. : see if this is an utime system
  7173. set utime.h i_utime
  7174. eval $inhdr
  7175.  
  7176. : see if this is a vfork system
  7177. case "$d_vfork" in
  7178. "$define")
  7179.     set vfork.h i_vfork
  7180.     eval $inhdr
  7181.     ;;
  7182. *)
  7183.     i_vfork="$undef"
  7184.     ;;
  7185. esac
  7186.  
  7187. : end of configuration questions
  7188. echo " "
  7189. echo "End of configuration questions."
  7190. echo " "
  7191.  
  7192. : back to where it started
  7193. if test -d ../UU; then
  7194.     cd ..
  7195. fi
  7196.  
  7197. : configuration may be patched via a 'config.over' file
  7198. if $test -f config.over; then
  7199.     echo " "
  7200.     dflt=y
  7201.     rp='I see a config.over file.  Do you wish to load it?'
  7202.     . UU/myread
  7203.     case "$ans" in
  7204.     n*) echo "OK, I'll ignore it.";;
  7205.     *)    . ./config.over
  7206.         echo "Configuration override changes have been loaded."
  7207.         ;;
  7208.     esac
  7209. fi
  7210.  
  7211. : create config.sh file
  7212. echo " "
  7213. echo "Creating config.sh..." >&4
  7214. $spitshell <<EOT >config.sh
  7215. $startsh
  7216. #
  7217. # This file was produced by running the Configure script. It holds all the
  7218. # definitions figured out by Configure. Should you modify one of these values,
  7219. # do not forget to propagate your changes by running "Configure -der". You may
  7220. # instead choose to run each of the .SH files by yourself, or "Configure -S".
  7221. #
  7222.  
  7223. # Configuration time: $cf_time
  7224. # Configured by: $cf_by
  7225. # Target system: $myuname
  7226.  
  7227. dynamic_ext='$dynamic_ext'
  7228. extensions='$extensions'
  7229. known_extensions='$known_extensions'
  7230. static_ext='$static_ext'
  7231. useposix='$useposix'
  7232. d_eunice='$d_eunice'
  7233. d_xenix='$d_xenix'
  7234. eunicefix='$eunicefix'
  7235. Mcc='$Mcc'
  7236. awk='$awk'
  7237. bash='$bash'
  7238. bison='$bison'
  7239. byacc='$byacc'
  7240. cat='$cat'
  7241. chgrp='$chgrp'
  7242. chmod='$chmod'
  7243. chown='$chown'
  7244. compress='$compress'
  7245. cp='$cp'
  7246. cpio='$cpio'
  7247. cpp='$cpp'
  7248. csh='$csh'
  7249. date='$date'
  7250. echo='$echo'
  7251. egrep='$egrep'
  7252. emacs='$emacs'
  7253. expr='$expr'
  7254. find='$find'
  7255. flex='$flex'
  7256. gcc='$gcc'
  7257. grep='$grep'
  7258. inews='$inews'
  7259. ksh='$ksh'
  7260. less='$less'
  7261. line='$line'
  7262. lint='$lint'
  7263. ln='$ln'
  7264. lp='$lp'
  7265. lpr='$lpr'
  7266. ls='$ls'
  7267. mail='$mail'
  7268. mailx='$mailx'
  7269. make='$make'
  7270. mkdir='$mkdir'
  7271. more='$more'
  7272. mv='$mv'
  7273. nroff='$nroff'
  7274. perl='$perl'
  7275. pg='$pg'
  7276. pmake='$pmake'
  7277. pr='$pr'
  7278. rm='$rm'
  7279. rmail='$rmail'
  7280. sed='$sed'
  7281. sendmail='$sendmail'
  7282. sh='$sh'
  7283. shar='$shar'
  7284. sleep='$sleep'
  7285. smail='$smail'
  7286. sort='$sort'
  7287. submit='$submit'
  7288. tail='$tail'
  7289. tar='$tar'
  7290. tbl='$tbl'
  7291. test='$test'
  7292. touch='$touch'
  7293. tr='$tr'
  7294. troff='$troff'
  7295. uname='$uname'
  7296. uniq='$uniq'
  7297. uuname='$uuname'
  7298. vi='$vi'
  7299. zcat='$zcat'
  7300. libswanted='$libswanted'
  7301. hint='$hint'
  7302. myuname='$myuname'
  7303. osname='$osname'
  7304. osvers='$osvers'
  7305. Author='$Author'
  7306. Date='$Date'
  7307. Header='$Header'
  7308. Id='$Id'
  7309. Locker='$Locker'
  7310. Log='$Log'
  7311. RCSfile='$RCSfile'
  7312. Revision='$Revision'
  7313. Source='$Source'
  7314. State='$State'
  7315. afs='$afs'
  7316. alignbytes='$alignbytes'
  7317. archlib='$archlib'
  7318. archlibexp='$archlibexp'
  7319. archname='$archname'
  7320. d_archlib='$d_archlib'
  7321. installarchlib='$installarchlib'
  7322. bin='$bin'
  7323. binexp='$binexp'
  7324. installbin='$installbin'
  7325. byteorder='$byteorder'
  7326. cc='$cc'
  7327. gccversion='$gccversion'
  7328. ccflags='$ccflags'
  7329. cppflags='$cppflags'
  7330. ldflags='$ldflags'
  7331. lkflags='$lkflags'
  7332. optimize='$optimize'
  7333. cf_by='$cf_by'
  7334. cf_time='$cf_time'
  7335. contains='$contains'
  7336. cpp_stuff='$cpp_stuff'
  7337. cpplast='$cpplast'
  7338. cppminus='$cppminus'
  7339. cpprun='$cpprun'
  7340. cppstdin='$cppstdin'
  7341. d_access='$d_access'
  7342. d_alarm='$d_alarm'
  7343. d_attrib='$d_attrib'
  7344. d_bcmp='$d_bcmp'
  7345. d_bcopy='$d_bcopy'
  7346. d_bzero='$d_bzero'
  7347. d_casti32='$d_casti32'
  7348. castflags='$castflags'
  7349. d_castneg='$d_castneg'
  7350. d_charsprf='$d_charsprf'
  7351. d_chown='$d_chown'
  7352. d_chroot='$d_chroot'
  7353. d_chsize='$d_chsize'
  7354. d_closedir='$d_closedir'
  7355. d_void_closedir='$d_void_closedir'
  7356. d_const='$d_const'
  7357. cryptlib='$cryptlib'
  7358. d_crypt='$d_crypt'
  7359. d_csh='$d_csh'
  7360. d_cuserid='$d_cuserid'
  7361. d_dbl_dig='$d_dbl_dig'
  7362. d_difftime='$d_difftime'
  7363. d_dlerror='$d_dlerror'
  7364. d_dlopen='$d_dlopen'
  7365. d_dlsymun='$d_dlsymun'
  7366. d_dosuid='$d_dosuid'
  7367. d_suidsafe='$d_suidsafe'
  7368. d_drem='$d_drem'
  7369. d_dup2='$d_dup2'
  7370. d_fchmod='$d_fchmod'
  7371. d_fchown='$d_fchown'
  7372. d_fcntl='$d_fcntl'
  7373. d_fd_macros='$d_fd_macros'
  7374. d_fd_set='$d_fd_set'
  7375. d_fds_bits='$d_fds_bits'
  7376. d_fgetpos='$d_fgetpos'
  7377. d_flexfnam='$d_flexfnam'
  7378. d_flock='$d_flock'
  7379. d_fmod='$d_fmod'
  7380. d_fork='$d_fork'
  7381. d_fsetpos='$d_fsetpos'
  7382. d_Gconvert='$d_Gconvert'
  7383. d_getgrps='$d_getgrps'
  7384. d_gethent='$d_gethent'
  7385. aphostname='$aphostname'
  7386. d_gethname='$d_gethname'
  7387. d_phostname='$d_phostname'
  7388. d_uname='$d_uname'
  7389. d_getlogin='$d_getlogin'
  7390. d_getpgrp2='$d_getpgrp2'
  7391. d_getpgrp='$d_getpgrp'
  7392. d_getppid='$d_getppid'
  7393. d_getprior='$d_getprior'
  7394. d_group='$d_group'
  7395. d_htonl='$d_htonl'
  7396. d_isascii='$d_isascii'
  7397. d_killpg='$d_killpg'
  7398. d_link='$d_link'
  7399. d_linuxstd='$d_linuxstd'
  7400. d_locconv='$d_locconv'
  7401. d_lockf='$d_lockf'
  7402. d_lstat='$d_lstat'
  7403. d_mblen='$d_mblen'
  7404. d_mbstowcs='$d_mbstowcs'
  7405. d_mbtowc='$d_mbtowc'
  7406. d_memcmp='$d_memcmp'
  7407. d_memcpy='$d_memcpy'
  7408. d_memmove='$d_memmove'
  7409. d_memset='$d_memset'
  7410. d_mkdir='$d_mkdir'
  7411. d_mkfifo='$d_mkfifo'
  7412. d_mktime='$d_mktime'
  7413. d_msg='$d_msg'
  7414. d_msgctl='$d_msgctl'
  7415. d_msgget='$d_msgget'
  7416. d_msgrcv='$d_msgrcv'
  7417. d_msgsnd='$d_msgsnd'
  7418. d_nice='$d_nice'
  7419. d_open3='$d_open3'
  7420. d_passwd='$d_passwd'
  7421. d_fpathconf='$d_fpathconf'
  7422. d_pathconf='$d_pathconf'
  7423. d_pause='$d_pause'
  7424. d_pipe='$d_pipe'
  7425. d_portable='$d_portable'
  7426. d_readdir='$d_readdir'
  7427. d_rewinddir='$d_rewinddir'
  7428. d_seekdir='$d_seekdir'
  7429. d_telldir='$d_telldir'
  7430. d_readlink='$d_readlink'
  7431. d_rename='$d_rename'
  7432. d_rmdir='$d_rmdir'
  7433. d_safebcpy='$d_safebcpy'
  7434. d_safemcpy='$d_safemcpy'
  7435. d_select='$d_select'
  7436. d_sem='$d_sem'
  7437. d_semctl='$d_semctl'
  7438. d_semget='$d_semget'
  7439. d_semop='$d_semop'
  7440. d_setegid='$d_setegid'
  7441. d_seteuid='$d_seteuid'
  7442. d_setlinebuf='$d_setlinebuf'
  7443. d_setlocale='$d_setlocale'
  7444. d_setpgid='$d_setpgid'
  7445. d_setpgrp2='$d_setpgrp2'
  7446. d_bsdpgrp='$d_bsdpgrp'
  7447. d_setpgrp='$d_setpgrp'
  7448. d_setprior='$d_setprior'
  7449. d_setregid='$d_setregid'
  7450. d_setresgid='$d_setresgid'
  7451. d_setresuid='$d_setresuid'
  7452. d_setreuid='$d_setreuid'
  7453. d_setrgid='$d_setrgid'
  7454. d_setruid='$d_setruid'
  7455. d_setsid='$d_setsid'
  7456. d_shm='$d_shm'
  7457. d_shmat='$d_shmat'
  7458. d_shmatprototype='$d_shmatprototype'
  7459. shmattype='$shmattype'
  7460. d_shmctl='$d_shmctl'
  7461. d_shmdt='$d_shmdt'
  7462. d_shmget='$d_shmget'
  7463. d_oldsock='$d_oldsock'
  7464. d_socket='$d_socket'
  7465. d_sockpair='$d_sockpair'
  7466. sockethdr='$sockethdr'
  7467. socketlib='$socketlib'
  7468. d_statblks='$d_statblks'
  7469. d_stdstdio='$d_stdstdio'
  7470. d_index='$d_index'
  7471. d_strchr='$d_strchr'
  7472. d_strcoll='$d_strcoll'
  7473. d_strctcpy='$d_strctcpy'
  7474. d_strerrm='$d_strerrm'
  7475. d_strerror='$d_strerror'
  7476. d_sysernlst='$d_sysernlst'
  7477. d_syserrlst='$d_syserrlst'
  7478. d_strxfrm='$d_strxfrm'
  7479. d_symlink='$d_symlink'
  7480. d_syscall='$d_syscall'
  7481. d_sysconf='$d_sysconf'
  7482. d_system='$d_system'
  7483. d_tcgetpgrp='$d_tcgetpgrp'
  7484. d_tcsetpgrp='$d_tcsetpgrp'
  7485. d_time='$d_time'
  7486. timetype='$timetype'
  7487. clocktype='$clocktype'
  7488. d_times='$d_times'
  7489. d_truncate='$d_truncate'
  7490. d_tzname='$d_tzname'
  7491. d_umask='$d_umask'
  7492. d_vfork='$d_vfork'
  7493. usevfork='$usevfork'
  7494. d_voidsig='$d_voidsig'
  7495. signal_t='$signal_t'
  7496. d_volatile='$d_volatile'
  7497. d_charvspr='$d_charvspr'
  7498. d_vprintf='$d_vprintf'
  7499. d_wait4='$d_wait4'
  7500. d_waitpid='$d_waitpid'
  7501. d_wcstombs='$d_wcstombs'
  7502. d_wctomb='$d_wctomb'
  7503. dlext='$dlext'
  7504. cccdlflags='$cccdlflags'
  7505. ccdlflags='$ccdlflags'
  7506. dlsrc='$dlsrc'
  7507. lddlflags='$lddlflags'
  7508. usedl='$usedl'
  7509. fpostype='$fpostype'
  7510. gidtype='$gidtype'
  7511. groupstype='$groupstype'
  7512. h_fcntl='$h_fcntl'
  7513. h_sysfile='$h_sysfile'
  7514. i_db='$i_db'
  7515. i_dbm='$i_dbm'
  7516. d_dirnamlen='$d_dirnamlen'
  7517. direntrytype='$direntrytype'
  7518. i_dirent='$i_dirent'
  7519. i_dld='$i_dld'
  7520. i_dlfcn='$i_dlfcn'
  7521. i_fcntl='$i_fcntl'
  7522. i_float='$i_float'
  7523. i_gdbm='$i_gdbm'
  7524. i_grp='$i_grp'
  7525. i_limits='$i_limits'
  7526. i_malloc='$i_malloc'
  7527. i_math='$i_math'
  7528. i_memory='$i_memory'
  7529. i_ndbm='$i_ndbm'
  7530. i_neterrno='$i_neterrno'
  7531. i_niin='$i_niin'
  7532. i_sysin='$i_sysin'
  7533. d_pwage='$d_pwage'
  7534. d_pwchange='$d_pwchange'
  7535. d_pwclass='$d_pwclass'
  7536. d_pwcomment='$d_pwcomment'
  7537. d_pwexpire='$d_pwexpire'
  7538. d_pwquota='$d_pwquota'
  7539. i_pwd='$i_pwd'
  7540. i_stddef='$i_stddef'
  7541. i_stdlib='$i_stdlib'
  7542. i_string='$i_string'
  7543. strings='$strings'
  7544. i_sysdir='$i_sysdir'
  7545. i_sysfile='$i_sysfile'
  7546. d_voidtty='$d_voidtty'
  7547. i_bsdioctl='$i_bsdioctl'
  7548. i_sysfilio='$i_sysfilio'
  7549. i_sysioctl='$i_sysioctl'
  7550. i_syssockio='$i_syssockio'
  7551. i_sysndir='$i_sysndir'
  7552. i_sysparam='$i_sysparam'
  7553. i_sysselct='$i_sysselct'
  7554. i_systimes='$i_systimes'
  7555. i_sgtty='$i_sgtty'
  7556. i_termio='$i_termio'
  7557. i_termios='$i_termios'
  7558. i_systime='$i_systime'
  7559. i_systimek='$i_systimek'
  7560. i_time='$i_time'
  7561. timeincl='$timeincl'
  7562. i_unistd='$i_unistd'
  7563. i_utime='$i_utime'
  7564. i_stdarg='$i_stdarg'
  7565. i_varargs='$i_varargs'
  7566. i_varhdr='$i_varhdr'
  7567. i_vfork='$i_vfork'
  7568. intsize='$intsize'
  7569. libc='$libc'
  7570. glibpth='$glibpth'
  7571. libpth='$libpth'
  7572. plibpth='$plibpth'
  7573. xlibpth='$xlibpth'
  7574. libs='$libs'
  7575. lns='$lns'
  7576. lseektype='$lseektype'
  7577. d_mymalloc='$d_mymalloc'
  7578. mallocobj='$mallocobj'
  7579. mallocsrc='$mallocsrc'
  7580. malloctype='$malloctype'
  7581. usemymalloc='$usemymalloc'
  7582. installmansrc='$installmansrc'
  7583. manext='$manext'
  7584. mansrc='$mansrc'
  7585. mansrcexp='$mansrcexp'
  7586. huge='$huge'
  7587. large='$large'
  7588. medium='$medium'
  7589. models='$models'
  7590. small='$small'
  7591. split='$split'
  7592. modetype='$modetype'
  7593. mydomain='$mydomain'
  7594. myhostname='$myhostname'
  7595. phostname='$phostname'
  7596. c='$c'
  7597. n='$n'
  7598. groupcat='$groupcat'
  7599. hostcat='$hostcat'
  7600. passcat='$passcat'
  7601. orderlib='$orderlib'
  7602. ranlib='$ranlib'
  7603. package='$package'
  7604. spackage='$spackage'
  7605. prefix='$prefix'
  7606. installprivlib='$installprivlib'
  7607. privlib='$privlib'
  7608. privlibexp='$privlibexp'
  7609. prototype='$prototype'
  7610. randbits='$randbits'
  7611. installscript='$installscript'
  7612. scriptdir='$scriptdir'
  7613. scriptdirexp='$scriptdirexp'
  7614. selecttype='$selecttype'
  7615. sig_name='$sig_name'
  7616. sizetype='$sizetype'
  7617. so='$so'
  7618. sharpbang='$sharpbang'
  7619. shsharp='$shsharp'
  7620. spitshell='$spitshell'
  7621. ssizetype='$ssizetype'
  7622. startsh='$startsh'
  7623. stdchar='$stdchar'
  7624. sysman='$sysman'
  7625. uidtype='$uidtype'
  7626. nm_opt='$nm_opt'
  7627. runnm='$runnm'
  7628. usenm='$usenm'
  7629. incpath='$incpath'
  7630. mips='$mips'
  7631. mips_type='$mips_type'
  7632. usrinc='$usrinc'
  7633. defvoidused='$defvoidused'
  7634. voidflags='$voidflags'
  7635. yacc='$yacc'
  7636. yaccflags='$yaccflags'
  7637. EOT
  7638.  
  7639. : add special variables
  7640. $test -f patchlevel.h && \
  7641. awk '/^#define/ {printf "%s=%s\n",$2,$3}' patchlevel.h >>config.sh
  7642. echo "CONFIG=true" >>config.sh
  7643.  
  7644. : propagate old symbols
  7645. if $test -f UU/config.sh; then
  7646.     <UU/config.sh sort | uniq >UU/oldconfig.sh
  7647.     sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
  7648.     sort | uniq -u >UU/oldsyms
  7649.     set X `cat UU/oldsyms`
  7650.     shift
  7651.     case $# in
  7652.     0) ;;
  7653.     *)
  7654.         cat <<EOM
  7655. Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
  7656. EOM
  7657.         echo "# Variables propagated from previous config.sh file." >>config.sh
  7658.         for sym in `cat UU/oldsyms`; do
  7659.             echo "    Propagating $hint variable "'$'"$sym..."
  7660.             eval 'tmp="$'"${sym}"'"'
  7661.             echo "$tmp" | \
  7662.                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
  7663.         done
  7664.         ;;
  7665.     esac
  7666. fi
  7667.  
  7668. : Finish up by extracting the .SH files
  7669. case "$alldone" in
  7670. exit)
  7671.     $rm -rf UU
  7672.     echo "Done."
  7673.     exit 0
  7674.     ;;
  7675. cont)
  7676.     ;;
  7677. '')
  7678.     echo " "
  7679.     dflt=''
  7680.     nostick=true
  7681. echo "If you didn't make any mistakes, then just type a carriage return here."
  7682.     rp="If you need to edit config.sh, do it as a shell escape here:"
  7683.     . UU/myread
  7684.     nostick=''
  7685.     case "$ans" in
  7686.     '') ;;
  7687.     *) : in case they cannot read
  7688.         sh 1>&4 -c "$ans";;
  7689.     esac
  7690.     ;;
  7691. esac
  7692.  
  7693. : if this fails, just run all the .SH files by hand
  7694. . ./config.sh
  7695.  
  7696. echo " "
  7697. exec 1>&4
  7698. . ./UU/extract
  7699.  
  7700. if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
  7701.     dflt=y
  7702.     case "$silent" in
  7703.     true) ;;
  7704.     *)
  7705.         $cat <<EOM
  7706.  
  7707. Now you need to generate make dependencies by running "make depend".
  7708. You might prefer to run it in background: "make depend > makedepend.out &"
  7709. It can take a while, so you might not want to run it right now.
  7710.  
  7711. EOM
  7712.         ;;
  7713.     esac
  7714.     rp="Run make depend now?"
  7715.     . UU/myread
  7716.     case "$ans" in
  7717.     y*)
  7718.         make depend && echo "Now you must run a make."
  7719.         ;;
  7720.     *)
  7721.         echo "You must run 'make depend' then 'make'."
  7722.         ;;
  7723.     esac
  7724. elif test -f [Mm]akefile; then
  7725.     echo " "
  7726.     echo "Now you must run a make."
  7727. else
  7728.     echo "Done."
  7729. fi
  7730.  
  7731. $rm -f kit*isdone ark*isdone
  7732. $rm -rf UU
  7733.  
  7734. : End of Configure
  7735.  
  7736.